|
oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
|
Simple NTP client for time synchronization. More...
Data Structures | |
| struct | ove_sntp_config_t |
| SNTP client configuration. More... | |
Functions | |
| int | ove_sntp_sync (const ove_sntp_config_t *cfg) |
| Synchronize with an NTP server. | |
| int | ove_sntp_get_offset_us (int64_t *offset_us) |
| Get the UTC offset computed by the last successful sync. | |
| int | ove_sntp_get_utc (uint32_t *utc_s) |
| Get the current UTC time in seconds since Unix epoch. | |
Simple NTP client for time synchronization.
Sends a single NTP query to a time server and stores the UTC offset relative to the monotonic clock. Useful for wall-clock timestamps, TLS certificate validation, and log correlation.
CONFIG_OVE_NET_SNTP (implies CONFIG_OVE_NET and CONFIG_OVE_TIME). | int ove_sntp_sync | ( | const ove_sntp_config_t * | cfg | ) |
Synchronize with an NTP server.
Sends a single NTP request and stores the computed UTC offset. Subsequent calls update the stored offset.
| [in] | cfg | Configuration (NULL for defaults: pool.ntp.org, 5s timeout). |
| int ove_sntp_get_offset_us | ( | int64_t * | offset_us | ) |
Get the UTC offset computed by the last successful sync.
The offset can be added to ove_time_get_us() to approximate wall-clock time (microseconds since Unix epoch).
| [out] | offset_us | UTC offset in microseconds. |
| int ove_sntp_get_utc | ( | uint32_t * | utc_s | ) |
Get the current UTC time in seconds since Unix epoch.
Convenience function: returns monotonic time + NTP offset.
| [out] | utc_s | UTC seconds since 1970-01-01 00:00:00. |