sntp_request
sntp_request
Tiny Rust library to request timestamp from NTP servers trough SNTP protocol.
The example below shows how to obtain precise timestamp from main NTP server:
```rust extern crate chrono; extern crate sntp_request;
use chrono::{Local, TimeZone}; use sntp_request::SntpRequest;
fn main() { let sntp = SntpRequest::new(); let timestamp = Local.timestamp(sntp.getunixtime().unwrap(), 0); println!("{}", timestamp); } ```
Add this to your Cargo.toml
:
ini
[dependencies]
sntp_request = "1.0.0"
and this to your crate root:
rust
extern crate sntp_request;
Pull Requests and Issues are welcome!
sntp_request
is licensed under either of the following, at your option: