Skip to main content

Module replay_clock

Module replay_clock 

Source
Expand description

Deterministic replay clock — the only WASM clock (W12, T71).

In a WASM environment, there is no wall clock — SystemTime::now() is either unavailable or non-deterministic. The only honest clock is a replay Instant: an Instant from a recorded timeline that is fed to the engine deterministically.

This module provides:

  • ReplayClock: a deterministic clock that yields Instants from a recorded timeline. Each call to tick() advances to the next recorded Instant.
  • ReplayTimeline: a recorded sequence of Instants with optional payloads (for replaying sensor data, animation frames, etc.).
  • Integration with the Host trait: a WASM host uses ReplayClock as its time_now implementation.

§One clock story (T71)

This is part of the “one clock story” — replacing the scattered coarse Unix clocks (time.unix(), asserted_time_unix: u32 in wellfare-core, etc.) with a single Instant-based clock. The replay clock is the WASM edge of that story: where native hosts use SystemTime::now(), WASM hosts use ReplayClock::tick().

Reference: docs/vibescript-full-impl-PLAN.md §8.14 T71, §8.15 W12, excellence-first §3.14, §4.

Structs§

ReplayClock
A deterministic replay clock — the only WASM clock (W12).
ReplayTimeline
A recorded timeline of Instants with optional payloads (W12).

Enums§

ExhaustedPolicy
What to do when the replay timeline is exhausted (W12).