Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
time_shield::ntp Namespace Reference

Functions

bool init (std::chrono::milliseconds interval=std::chrono::seconds(30), bool measure_immediately=true)
 Initialize NTP time service and start background measurements.
 
bool init (int interval_ms, bool measure_immediately=true)
 Initialize NTP time service using milliseconds.
 
void shutdown ()
 Stop NTP time service.
 
int64_t offset_us () noexcept
 Return last estimated offset in microseconds.
 
int64_t utc_time_us () noexcept
 Return current UTC time in microseconds based on offset.
 
int64_t utc_time_ms () noexcept
 Return current UTC time in milliseconds based on offset.
 
int64_t utc_time_sec () noexcept
 Return current UTC time in seconds based on offset.
 
bool last_measure_ok () noexcept
 Return whether last measurement updated the offset.
 
uint64_t measure_count () noexcept
 Return total number of measurement attempts.
 
uint64_t fail_count () noexcept
 Return number of failed measurement attempts.
 
int64_t last_update_realtime_us () noexcept
 Return realtime timestamp of last measurement attempt.
 
int64_t last_success_realtime_us () noexcept
 Return realtime timestamp of last successful measurement.
 
bool stale (std::chrono::milliseconds max_age) noexcept
 Return true when last measurement is older than max_age.