3 stable releases
new 1.3.0 | Mar 31, 2025 |
---|---|
1.2.0 | Mar 30, 2025 |
1.1.0 | Mar 30, 2025 |
1.0.0 |
|
#194 in Date and time
268 downloads per month
22KB
400 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