Skip to main content

Module clock

Module clock 

Source
Expand description

Clocks: where “now” comes from, injected so tests can fix it.

The jobs model (time left, how long a job ran) and the motion clock (spinners, delays, shimmer) read a Clock instead of the system’s time: an application gives none and gets the interface’s own time; a test gives a ManualClock and moves it by hand.

use egui_pop_model::clock::{Clock, ManualClock};

let clock = ManualClock::new(10.0);
clock.advance(0.25);
assert_eq!(clock.now(), 10.25);

Structs§

ManualClock
A clock that moves only when told: tests freeze, set and step it. Clones share the same time.

Traits§

Clock
A source of time, in seconds from an origin of its own.

Type Aliases§

SharedClock
A clock shared between its users.