FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
time::RTTTime Class Reference

Structure used to hold a time value with microsecond precision. More...

#include <fastarduino/time.h>

Public Member Functions

 RTTTime (uint32_t micros=0UL)
 Construct a new RTTTime value. More...
 
 RTTTime (uint32_t millis, uint16_t micros)
 Construct a new RTTTime value. More...
 
 RTTTime (const RTTTime &that)
 Construct a copy of that. More...
 
RTTTimeoperator= (const RTTTime &that)
 Assign this RTTTime instance from that. More...
 
RTTTimeoperator+= (uint32_t microseconds)
 Add microseconds to this RTTTime instance. More...
 
RTTTimeoperator-= (uint32_t microseconds)
 Remove microseconds from this RTTTime instance. More...
 
uint32_t total_micros () const
 Return current elapsed time in microseconds only.
 
uint32_t millis () const
 Number of elapsed milliseconds.
 
uint16_t micros () const
 Number of elapsed microseconds (0..999).
 

Detailed Description

Structure used to hold a time value with microsecond precision.

Note that this value is not absolute but relative to some time base, not defined here, but depending on the API producing or consuming an RTTTime.

Parameters
millisnumber of milliseconds elapsed since some predefined time base
microsnumber of microseconds, added to millis, elapsed since some predefined time base reference, between 0 and 999; setting a greater value is not supported and will have an undefined behavior of the API consuming such an RTTTime instance.

Definition at line 49 of file time.h.

Constructor & Destructor Documentation

◆ RTTTime() [1/3]

time::RTTTime::RTTTime ( uint32_t  micros = 0UL)
inlineexplicit

Construct a new RTTTime value.

Parameters
microsnumber of microseconds (can be > 1000us)

Definition at line 56 of file time.h.

◆ RTTTime() [2/3]

time::RTTTime::RTTTime ( uint32_t  millis,
uint16_t  micros 
)
inline

Construct a new RTTTime value.

Parameters
millisnumber of milliseconds
microsnumber of microseconds (0..999)

Definition at line 63 of file time.h.

◆ RTTTime() [3/3]

time::RTTTime::RTTTime ( const RTTTime that)
inline

Construct a copy of that.

Parameters
that

Definition at line 69 of file time.h.

Member Function Documentation

◆ operator=()

RTTTime& time::RTTTime::operator= ( const RTTTime that)
inline

Assign this RTTTime instance from that.

Parameters
thatthe source real time value
Returns
this instance

Definition at line 76 of file time.h.

◆ operator+=()

RTTTime& time::RTTTime::operator+= ( uint32_t  microseconds)
inline

Add microseconds to this RTTTime instance.

Parameters
microsecondsthe number of us to add to this RTTTime
Returns
this instance

Definition at line 91 of file time.h.

◆ operator-=()

RTTTime& time::RTTTime::operator-= ( uint32_t  microseconds)
inline

Remove microseconds from this RTTTime instance.

Parameters
microsecondsthe number of us to subtract from this RTTTime; results are undetermined if microseconds is larger than total_micros().
Returns
this instance

Definition at line 111 of file time.h.


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