#protocol #network #time #parser #binary

bin+lib ntp

Library for parsing and communicating over Network Time Protocol

8 releases (4 breaking)

0.5.0 Jun 29, 2018
0.4.0 Oct 26, 2017
0.3.1 Oct 21, 2017
0.3.0 Jul 12, 2017
0.1.1 Feb 23, 2017

#4 in Date and time

Download history 294/week @ 2018-10-04 428/week @ 2018-10-11 311/week @ 2018-10-18 490/week @ 2018-10-25 396/week @ 2018-11-01 459/week @ 2018-11-08 198/week @ 2018-11-15 136/week @ 2018-11-22 174/week @ 2018-11-29 151/week @ 2018-12-06 197/week @ 2018-12-13 161/week @ 2018-12-20 118/week @ 2018-12-27 144/week @ 2019-01-03 99/week @ 2019-01-10

4,521 downloads per month

MIT/Apache

21KB
497 lines

Ntplib

An ntp packet parsing library written in Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
ntp = "0.5"

and this to your crate root:

extern crate ntp;

Todo

  • no-std
  • io independent parsing
  • async support
  • setting clocks
  • ntp server functionality

Contributions

Pull Requests and Issues welcome!

License

ntp is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.


lib.rs:

Example

fn main() {
let address = "0.pool.ntp.org:123";
let response: ntp::packet::Packet = ntp::request(address).unwrap();
let ntp_time = response.transmit_time;
println!("{}", ntp_time);
}

Dependencies

~1MB
~14K SLoC