#protocol #network #time #parser #binary

bin+lib ntp

Library for parsing and communicating over Network Time Protocol

8 releases (4 breaking)

Uses old Rust 2015

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

#7 in #time-parser

Download history 333/week @ 2022-11-28 338/week @ 2022-12-05 285/week @ 2022-12-12 175/week @ 2022-12-19 125/week @ 2022-12-26 167/week @ 2023-01-02 277/week @ 2023-01-09 180/week @ 2023-01-16 219/week @ 2023-01-23 248/week @ 2023-01-30 167/week @ 2023-02-06 239/week @ 2023-02-13 193/week @ 2023-02-20 151/week @ 2023-02-27 326/week @ 2023-03-06 251/week @ 2023-03-13

962 downloads per month
Used in self_sdk

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

~1–1.6MB
~31K SLoC