BlueToe
an alternative GATT/BLE implementation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Related Functions | List of all members
bluetoe::link_layer::delta_time Class Reference

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_timeoperator+= (const delta_time &rhs)
 adds rhs to this
 
delta_timeoperator-= (const delta_time &rhs)
 substracts rhs from this.
 
delta_timeoperator*= (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
 

Detailed Description

positiv time quantum used to express distance in time.

Member Function Documentation

◆ operator-=()

delta_time & bluetoe::link_layer::delta_time::operator-= ( const delta_time rhs)

substracts rhs from this.

Precondition
*this >= rhs

◆ operator/()

unsigned bluetoe::link_layer::delta_time::operator/ ( const delta_time rhs)

devides this by rhs

Precondition
this* != delta_time()

◆ ppm()

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

Parameters
partthe parts of a million. The parameter have to in the range 0-1000 to not cause overflows.

◆ usec() [1/2]

std::uint32_t bluetoe::link_layer::delta_time::usec ( ) const

returns represented time distance as a number of µs.

delta_time( x ).usec() == x

◆ usec() [2/2]

static delta_time bluetoe::link_layer::delta_time::usec ( std::uint32_t  usec)
static

creates a delta_time from a positive number of µs (Microseconds).

◆ zero()

bool bluetoe::link_layer::delta_time::zero ( ) const

returns true, if the represented time distance is zero.

delta_time( 0 ).zero() == true


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