Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Friends | List of all members
bmptk::time Class Reference

time elapsed since some epoch More...

#include <time.h>

Public Member Functions

 time ()
 create an un-initialized time object
 
constexpr time operator+ (const time &rhs) const
 adding two times yields a time
 
void operator+= (const time &rhs)
 adding two times
 
constexpr time operator- (const time &rhs) const
 substracting two times yields a time
 
void operator-= (const time &rhs)
 substracting two times
 
constexpr time operator* (const int n) const
 multiplying a time by an integer yields a time
 
void operator*= (const int n)
 multiplying a time by an integer
 
constexpr time operator/ (const int n) const
 dividing a time by an integer yields a time
 
void operator/= (const int n)
 dividing a time by an integer
 
constexpr unsigned long long int operator/ (const time rhs) const
 dividing a time by another time yields an integer
 
constexpr bool operator< (const time rhs) const
 compare two times
 
constexpr bool operator<= (const time rhs) const
 compare two times
 
constexpr bool operator> (const time rhs) const
 compare two times
 
constexpr bool operator>= (const time rhs) const
 compare two times
 
constexpr bool operator== (const time rhs) const
 compare two times for equality
 
constexpr bool operator!= (const time rhs) const
 compare two times for inequality
 

Friends

bmptk::time bmptk::current_time ()
 

Detailed Description

time elapsed since some epoch

Time is expressed as the number of clock ticks elapsed since some epoch. On most targets the first call to current_time() starts the hardware timer, so the epch is this first call. Time is stored as an excapsulated unsigned long long int. The operators +, -, *, /, > and < are provided, as far as they make sense.

Application code must use constants us, ms and s to express time. The real unit of time is the number of us, not exceeding 1000. Hence the maximum time than is can be expressed is 18446744073 seconds, or 584 years.

All ime opeartions are constexpr and/or inline, hence the time abstraction imposes no overhead.

Definition at line 48 of file time.h.


The documentation for this class was generated from the following file: