|
SatCat5
|
The TimeRef API provides access to a monotonic time-counter.
SatCat5 system timer concepts.
If your project uses a custom time reference, make a custom class derived from the TimeRef base-class, and override the raw() method. To set that clock as the primary reference, call the timekeeper set_clock(...) or suggest_clock(...) methods. (See polling.h)
#include <timeref.h>
Public Member Functions | |
| virtual u32 | raw ()=0 |
| Read current time in arbitrary "ticks". More... | |
| TimeVal | now () |
| Create a TimeVal object using the tick-count from raw(). | |
| TimeVal | checkpoint_usec (unsigned usec) |
| Create an oven-timer, set N microseconds from now. More... | |
| TimeVal | checkpoint_msec (unsigned msec) |
| Create an oven-timer, set N milliseconds from now. More... | |
| void | busywait_usec (unsigned usec) |
| If timer resolution allows, busywait for X microseconds. More... | |
| u32 | ticks_per_sec () const |
| Stable accessors for unit conversion. More... | |
| u32 | ticks_per_msec () const |
| Stable accessors for unit conversion. More... | |
| u32 | ticks_per_usec () const |
| Stable accessors for unit conversion. More... | |
Protected Member Functions | |
| constexpr | TimeRef (u64 ticks_per_sec) |
| Constructor accepts a scale-factor for conversion to real-time. More... | |
Private Attributes | |
| u64 const | m_msec_per_tick |
| u64 const | m_usec_per_tick |
| u64 const | m_tick_per_msec |
| u64 const | m_tick_per_usec |
|
inlineexplicitconstexprprotected |
| void TimeRef::busywait_usec | ( | unsigned | usec | ) |
If timer resolution allows, busywait for X microseconds.
(May return immediately if backing reference is too coarse.)
Definition at line 93 of file timeref.cc.
| TimeVal TimeRef::checkpoint_msec | ( | unsigned | msec | ) |
Create an oven-timer, set N milliseconds from now.
An over-timer TimeVal is a timestamp a short time in the future. To use it, create the TimeVal and then poll checkpoint_elapsed(). (The returned TimeVal is intended to be used exactly once.)
Definition at line 73 of file timeref.cc.
| TimeVal TimeRef::checkpoint_usec | ( | unsigned | usec | ) |
Create an oven-timer, set N microseconds from now.
An over-timer TimeVal is a timestamp a short time in the future. To use it, create the TimeVal and then poll checkpoint_elapsed(). (The returned TimeVal is intended to be used exactly once.)
Definition at line 69 of file timeref.cc.
|
pure virtual |
Read current time in arbitrary "ticks".
Tick-count MUST roll-over from UINT32_MAX to zero. Roll-over MUST NOT occur more than once per second. (Child class MUST define this method.)
Implemented in satcat5::util::TimeRegister, satcat5::util::NullTimer, satcat5::cfg::Timer, satcat5::test::TimerSimulation, satcat5::test::FastPosixTimer, satcat5::sam::SysTickTimer, satcat5::util::PosixTimer, and satcat5::freertos::TickTimer.
|
inline |
|
inline |
|
inline |