[][src]Crate sntp_request

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);
}

Structs

SntpRequest

SNTP object which holds the socket handle to obtain timestamp from NTP servers.

SntpTimestamp

SNTP timestamp.

Constants

POOL_NTP_ADDR

Default public NTP address.

Type Definitions

SntpRawTimeResult

Specialized type for raw time result.

SntpUnixTimeResult

Specialized type for Unix time result.