1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
fn main() {
    let client = rsntp::SntpClient::new();
    let time_info = client.synchronize("pool.ntp.org").unwrap();

    println!(
        "Clock offset: {} ms",
        time_info.clock_offset().as_secs_f64() * 1000.0
    );
    println!(
        "Round trip delay: {} ms",
        time_info.round_trip_delay().as_secs_f64() * 1000.0
    );
    println!(
        "Server UTC UNIX timestamp: {}",
        time_info.datetime().unix_timestamp().unwrap().as_secs()
    );

    println!(
        "Reference identifier: {}",
        time_info.reference_identifier().to_string()
    );
    println!("Stratum: {}", time_info.stratum());
}