Module clock
Expand description
Time, injected rather than read.
Nothing in atune_core calls std::time directly. Every timestamp — trial
creation, completion, heartbeats, walltime budgets — comes from a Clock
handed in by the caller. Two reasons, both load-bearing:
- wasm.
wasm32-unknown-unknownhas no wall clock;SystemTime::now()panics there. Keeping time behind a trait is what letscargo check -p atune_core --target wasm32-unknown-unknown --no-default-featuresstay green. - Determinism. Tests drive
ManualClockand get reproducible heartbeat, deadline and fail-over behaviour instead of sleeping.
SystemClock is the production implementation and lives behind the
system feature. ManualClock is always available.
Structs§
- Manual
Clock - A clock that only moves when a test moves it.
- System
Clock - The operating system’s wall clock, in milliseconds since the Unix epoch.
Traits§
- Clock
- A source of milliseconds.