1 stable release
Uses new Rust 2024
new 1.0.0 | Mar 30, 2025 |
---|
#193 in #text
20KB
345 lines
barentp
An NTP client library for use with and without the standard library.
Usage
Take a look at the examples directory for usage examples.
lib.rs
:
An NTP client library for use with and without the standard library.
This library providers both block and non-blocking (async) interfaces for getting the current time from an NTP server.
The async
feature must be enabled to use the async interface found in
nonblocking
.
The std
feature can be enabled for an implementation of NtpTransport
and NtpTransportAsync
that uses the standard library's std::net::UdpSocket
.
The chrono
feature can be enabled for an implementation of From<Timestamp>
to the chrono
crate's NaiveDateTime
and DateTime<Utc>
types.
In order to use the library you will first need an implementation of the NtpTransport
or NtpTransportAsync
trait.
Then you can use one of sntp_get_transmit_timestamp
or
sntp_get_transmit_timestamp
to get the current time from
an NTP server. DNS lookup functionality is not provided by this library.
Dependencies
~0–280KB