This crate provides a method for sending requests to NTP servers and process responses, extracting received timestamp
This crate works with Cargo and is on
crates.io. Add it to your Cargo.toml
like so:
[dependencies]
sntpc = "0.1"
By calling the request()
method and providing a proper NTP pool or server you
should get a valid synchronization timestamp:
use sntpc;
let result = sntpc::request(POOL_NTP_ADDR, 123);
if let Ok(timestamp) = result {
assert_ne!(timestamp, 0);
println!("Timestamp: {}", timestamp);
}