adjusting_clock 0.1.0

Measure time, while synchronizing it with an external source, for example adjusting the clock of a client to match the time one of a server.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Using [`Clock`] as a stopwatch. No adjustments made.

use adjusting_clock::{Clock, ConstantRate};
use std::thread;
use std::time::{Duration, Instant};

pub fn main() {
    let clock = Clock::new(Instant::now(), ConstantRate(0.01));
    loop {
        let elapsed = clock.elapsed(Instant::now());
        println!("Current time: {0} ms", elapsed.as_millis());
        thread::sleep(Duration::from_millis(100));
    }
}