summaryrefslogtreecommitdiffstats
path: root/third_party/rust/zeitstempel/examples/uptime.rs
blob: 2cf9b62d5909555897cb918575104ca8ee993d82 (plain)
1
2
3
4
5
6
7
8
9
10
11
use std::{thread, time::Duration};

fn main() {
    let start = zeitstempel::now();
    println!("Now: {}", start);

    thread::sleep(Duration::from_secs(2));

    let diff = zeitstempel::now() - start;
    println!("Diff: {} ms", Duration::from_nanos(diff).as_millis());
}