Skip to main content

Module net_sntp

Module net_sntp 

Source
Expand description

Blocking SNTP time synchronization client.

Provides a safe Rust API for the oveRTOS SNTP subsystem. A single NTP query is sent to a time server and the resulting UTC offset is stored internally. Useful for wall-clock timestamps, TLS certificate validation, and log correlation.

§Async alternative

For async SNTP on top of crate::async_net use the sntpc crate from crates.io with the embassy-socket feature. Single-shot NTP query against any UDP-reachable server; no global UTC-offset state.

§Example

use ove::net_sntp;

let cfg = net_sntp::Config {
    server: b"pool.ntp.org\0",
    timeout: core::time::Duration::from_secs(5),
};
net_sntp::sync(&cfg).unwrap();
let utc = net_sntp::get_utc().unwrap();

Structs§

Config
SNTP client configuration.

Functions§

get_offset_us
Get the UTC offset computed by the last successful sync.
get_utc
Get the current UTC time in seconds since Unix epoch.
sync
Synchronize with an NTP server.