Skip to main content

Module clock

Module clock 

Source
Expand description

Pluggable clock — foundation’s now() defaults to Utc::now() but can be overridden (e.g., by mockforge-core::time_travel) via set_clock.

This allows foundation types like SessionState to respect time travel without depending on mockforge-core.

Functions§

now
Returns the current time. Uses the registered clock function if any, otherwise falls back to real wall-clock time (Utc::now()).
set_clock
Register a custom clock function. Can only be called once per process; subsequent calls are silently ignored (returns Err if already set).

Type Aliases§

ClockFn
Type alias for a clock function (returns the current time).