sntp_request 1.1.1

Tiny Rust library to request timestamp from NTP servers trough SNTP protocol.
Documentation

sntp_request

Build Status Crates.io Documentation License

sntp_request Tiny Rust library to request timestamp from NTP servers trough SNTP protocol.

Example

The example below shows how to obtain precise timestamp from main NTP server:

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.get_unix_time().unwrap(), 0);
    println!("{}", timestamp);
}

Usage

Add this to your Cargo.toml:

[dependencies]
sntp_request = "1.1.1"

and this to your crate root:

extern crate sntp_request;

Contributions

Pull Requests and Issues are welcome!

License

sntp_request is licensed under either of the following, at your option: