BlueToe
an alternative GATT/BLE implementation
|
positiv time quantum used to express distance in time. More...
#include <bluetoe/link_layer/include/bluetoe/delta_time.hpp>
Public Member Functions | |
constexpr | delta_time (std::uint32_t usec) |
creates a delta_time from a positive number of µs (Microseconds). | |
void | print (std::ostream &) const |
prints this on the given stream in a human readable manner | |
delta_time & | operator+= (const delta_time &rhs) |
adds rhs to this | |
delta_time & | operator-= (const delta_time &rhs) |
substracts rhs from this. | |
delta_time & | operator*= (unsigned rhs) |
scales this by rhs | |
unsigned | operator/ (const delta_time &rhs) |
devides this by rhs | |
bool | operator< (const delta_time &rhs) const |
returns true, if this is smaller than rhs | |
bool | operator<= (const delta_time &rhs) const |
returns true, if this is smaller than or equal to rhs | |
bool | operator> (const delta_time &rhs) const |
returns true, if this is larger than rhs | |
bool | operator>= (const delta_time &rhs) const |
returns true, if this is larger than or equal to rhs | |
bool | operator== (const delta_time &rhs) const |
returns true, if this is equal to rhs | |
bool | operator!= (const delta_time &rhs) const |
returns false, if this is equal to rhs | |
std::uint32_t | usec () const |
returns represented time distance as a number of µs. | |
bool | zero () const |
returns true, if the represented time distance is zero. | |
delta_time | ppm (unsigned part) const |
returns the given parts per million. | |
Static Public Member Functions | |
static delta_time | usec (std::uint32_t usec) |
creates a delta_time from a positive number of µs (Microseconds). | |
static delta_time | msec (std::uint32_t msec) |
creates a delta_time from a positive number of ms (milliseconds). | |
static delta_time | seconds (int s) |
creates a delta_time from a positive number of s (seconds). | |
static delta_time | now () |
creates a delta_time denoting the distance from now to now. Aka 0. | |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &, const delta_time &) |
prints the given delta_time on the given stream in a human readable manner | |
delta_time | operator+ (delta_time lhs, delta_time rhs) |
returns the sum of both delta_times | |
delta_time | operator- (delta_time lhs, delta_time rhs) |
returns the difference of both delta_times | |
delta_time | operator* (delta_time lhs, unsigned rhs) |
scales the given delta_time by the given factor | |
positiv time quantum used to express distance in time.
delta_time & bluetoe::link_layer::delta_time::operator-= | ( | const delta_time & | rhs | ) |
substracts rhs from this.
unsigned bluetoe::link_layer::delta_time::operator/ | ( | const delta_time & | rhs | ) |
devides this by rhs
delta_time bluetoe::link_layer::delta_time::ppm | ( | unsigned | part | ) | const |
returns the given parts per million.
delta_time::usec( 1000000 ).ppm( 44 ).usec() == 44
part | the parts of a million. The parameter have to in the range 0-1000 to not cause overflows. |
std::uint32_t bluetoe::link_layer::delta_time::usec | ( | ) | const |
returns represented time distance as a number of µs.
delta_time( x ).usec() == x
|
static |
creates a delta_time from a positive number of µs (Microseconds).
bool bluetoe::link_layer::delta_time::zero | ( | ) | const |
returns true, if the represented time distance is zero.
delta_time( 0 ).zero() == true