1 unstable release

Uses old Rust 2015

0.0.1 Jan 28, 2020

#43 in #time-parser


Used in dispatcher

MIT license

40KB
574 lines

Broker-NTP


An ntp packet parsing library written in Rust.


lib.rs:

Example

Shows how to use the ntp library to fetch the current time according to the requested ntp server.

extern crate chrono;
extern crate broker_ntp;

use chrono::TimeZone;

fn main() {
let address = "0.pool.ntp.org:123";
let response = broker_ntp::request(address).unwrap();
let unix_time = broker_ntp::unix_time::Instant::from(response.transmit_timestamp);
let local_time = chrono::Local.timestamp(unix_time.secs(), unix_time.subsec_nanos() as _);
println!("{}", local_time);
}

Dependencies

~375KB