|
SatCat5
|
Real-time clock for tracking date/time.
The global SATCAT5_CLOCK measures relative time only. This object tracks that TimeRef to indicate the current date/time.
To use this class:
set.now, gps, or ptp at any point to obtain the current date/time in the designated format. Definition at line 169 of file datetime.h.
#include <datetime.h>
Public Member Functions | |
| Clock () | |
| Constructor defaults to T = 0 (unknown). | |
| u32 | uptime_msec () const |
| Get elapsed time since startup, in milliseconds. More... | |
| u32 | uptime_usec () const |
| Get elapsed time since startup, in microseconds. More... | |
| void | reset (bool full=false) |
| Reset internals after changes to SATCAT5_CLOCK. More... | |
| void | set (s64 gps) |
| Set current GPS time. More... | |
| s64 | now () const |
| Current time as milliseconds since GPS epoch. | |
| satcat5::datetime::GpsTime | gps () const |
| Current time as GPS week number and time-of-week. | |
| satcat5::ptp::Time | ptp () const |
| Current time as Precision Time Protocol timestamp. | |
| satcat5::datetime::RtcTime | rtc () const |
| Current time as ISL12082 real-time clock timestamp. | |
Protected Member Functions | |
| void | timer_event () override |
| Child class MUST override this method. | |
| void | timer_once (unsigned msec) |
| Configure a one-time notification after X milliseconds. | |
| void | timer_every (unsigned msec) |
| Configure a repeating notification every X milliseconds. | |
| void | timer_stop () |
| Stop all future notifications. | |
| unsigned | timer_interval () const |
| Accessor for recurring timer interval, if one is set. | |
| unsigned | timer_remaining () const |
| Accessor for time to next event, if one is set. | |
Static Protected Member Functions | |
| static unsigned | count_timer () |
| Count all objects of this type, including idle timers. | |
Protected Attributes | |
| satcat5::util::TimeVal | m_tref |
| u32 | m_tcount |
| s64 | m_gps |
Private Member Functions | |
| void | query (unsigned elapsed_msec) |
Private Attributes | |
| satcat5::poll::Timer * | m_next |
| unsigned | m_trem |
| unsigned | m_tnext |
| void Clock::reset | ( | bool | full = false | ) |
Reset internals after changes to SATCAT5_CLOCK.
Optionally reset uptime and GPS time.
Definition at line 49 of file datetime.cc.
| void Clock::set | ( | s64 | gps | ) |
Set current GPS time.
(0 = Unknown) For conversion
from_gps, from_ptp, or from_rtc. Definition at line 54 of file datetime.cc.
|
inline |
Get elapsed time since startup, in milliseconds.
Definition at line 178 of file datetime.h.
| u32 Clock::uptime_usec | ( | ) | const |
Get elapsed time since startup, in microseconds.
Definition at line 44 of file datetime.cc.