CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
Time / RTC

Access monotonic uptime and the badge real-time clock. More...

Classes

struct  host_tm

Functions

uint64_t host_uptime_ms (void)
 Monotonic milliseconds since boot.
int64_t host_unix_time (void)
 Current Unix timestamp in seconds, or 0 if RTC not set.
int host_local_time (struct host_tm *out)
 Fill out with the current local time broken into fields.
int32_t host_timezone_offset (void)
 Configured timezone offset from UTC in seconds.
bool host_is_time_set (void)
 True when the RTC has been synchronised at least once.

Detailed Description

Access monotonic uptime and the badge real-time clock.

Use host_uptime_ms for elapsed-time measurements; use the wall-clock helpers (host_unix_time, host_local_time) only after checking host_is_time_set.

Function Documentation

◆ host_is_time_set()

bool host_is_time_set ( void )

True when the RTC has been synchronised at least once.

Definition at line 28 of file host_api_time.cpp.

References getRtcInstance().

Referenced by cdc::plugin_manager::w_host_is_time_set().

◆ host_local_time()

int host_local_time ( struct host_tm * out)

◆ host_timezone_offset()

int32_t host_timezone_offset ( void )

Configured timezone offset from UTC in seconds.

Definition at line 34 of file host_api_time.cpp.

References getRtcInstance().

Referenced by cdc::plugin_manager::w_host_timezone_offset().

◆ host_unix_time()

int64_t host_unix_time ( void )

Current Unix timestamp in seconds, or 0 if RTC not set.

Definition at line 22 of file host_api_time.cpp.

References getRtcInstance().

Referenced by cdc::plugin_manager::w_host_unix_time().

◆ host_uptime_ms()

uint64_t host_uptime_ms ( void )

Monotonic milliseconds since boot.

Definition at line 17 of file host_api_time.cpp.

Referenced by cdc::plugin_manager::w_host_uptime_ms().