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

#33 in #time-parser

Download history 144/week @ 2024-01-08 201/week @ 2024-01-15 190/week @ 2024-01-22 165/week @ 2024-01-29 196/week @ 2024-02-05 171/week @ 2024-02-12 233/week @ 2024-02-19 172/week @ 2024-02-26 228/week @ 2024-03-04 197/week @ 2024-03-11 262/week @ 2024-03-18 193/week @ 2024-03-25 231/week @ 2024-04-01 161/week @ 2024-04-08 130/week @ 2024-04-15 165/week @ 2024-04-22

700 downloads per month
Used in 3 crates

MIT/Apache

22KB
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–2MB
~32K SLoC