1 unstable release

0.1.0 Sep 7, 2020

#673 in Date and time

Download history 102/week @ 2024-12-16 26/week @ 2024-12-23 57/week @ 2024-12-30 144/week @ 2025-01-06 167/week @ 2025-01-13 90/week @ 2025-01-20 72/week @ 2025-01-27 116/week @ 2025-02-03 99/week @ 2025-02-10 134/week @ 2025-02-17 185/week @ 2025-02-24 162/week @ 2025-03-03 125/week @ 2025-03-10 158/week @ 2025-03-17 59/week @ 2025-03-24 126/week @ 2025-03-31

469 downloads per month
Used in eliprompt

MIT license

8KB
138 lines

Crate Docs MIT license

Defines a monotonic clock whose values are instances of Duration.

Why not std::time::Instant?

Instant is opaque and cannot be serialized.

Example

let mut clock = moniclock::Clock::new();
let t0 = clock.elapsed();
let sleep_duration = std::time::Duration::from_millis(100);
std::thread::sleep(sleep_duration);
let t1 = clock.elapsed();
assert!(t1 - t0 >= sleep_duration);

Dependencies

~215KB