Skip to main content

fixed_clock

Function fixed_clock 

Source
pub fn fixed_clock(unix_millis: i64) -> FixedClock
Expand description

A FixedClock pinned to unix_millis milliseconds since the Unix epoch.

A terse alias for FixedClock::at_unix_millis so tests read clearly:

use klauthed_testing::clock::{fixed_clock, Clock, Duration};

let clock = fixed_clock(1_700_000_000_000);
let t0 = clock.now();
clock.advance(Duration::seconds(5));
assert_eq!(clock.now().duration_since(t0).whole_seconds(), 5);