current_realtime

Function current_realtime 

Source
pub fn current_realtime() -> u64
Expand description

System-wide realtime clock. It is generally synchronized with the clock of the master server through the ntp protocol.

Examples found in repository?
examples/timestamp.rs (line 10)
4fn main() {
5    let ns = timestamp::current_monotime();
6    let mono = chrono::NaiveDateTime::from_timestamp(
7        (ns / 1000_000_000) as i64,
8        (ns % 1000_000_000) as u32,
9    );
10    let ns = timestamp::current_realtime();
11    let real = chrono::NaiveDateTime::from_timestamp(
12        (ns / 1000_000_000) as i64,
13        (ns % 1000_000_000) as u32,
14    );
15    let ns = timestamp::delta_of_mono_real_time();
16    let delta = chrono::NaiveDateTime::from_timestamp(
17        (ns / 1000_000_000) as i64,
18        (ns % 1000_000_000) as u32,
19    );
20
21    println!("monotonic time: {}", mono);
22    println!("real      time: {}", real);
23    println!("delta     time: {}", delta);
24}