A steppable virtual clock for tests: time advances only via advance/2.
Backs Fief.Seam.Sim for processes bound with Fief.Sim.bind_clock/1.
Timers armed through it deliver {:timeout, ref, msg} — the same shape as
Fief.Seam.Real — when advance/2 moves the clock past their deadline,
in deadline order.
Several clocks may coexist (per-node virtual clocks skewed against the
arbiter's clock, per design §6.4 / implementation.md §3.2). For simulations
that need an event queue — quiescence-gated advance, per-node skew, timer
firings as scripted events — use Fief.Sim.Scheduler, which implements
this module's call contract itself; ManualClock stays as the lightweight
clock-only hook.
Summary
Functions
Advance virtual time by ms, firing due timers in deadline order. Timer
messages are sent before advance/2 returns, but delivery interleaving with
other senders is the receiver's mailbox order as usual.
Cancel a virtual timer. Returns remaining ms or false if already fired.
Returns a specification to start this module under a supervisor.
Current virtual monotonic time, milliseconds.
Arm a virtual timer; delivers {:timeout, ref, msg} to dest when due.
Types
@type t() :: GenServer.server()
Functions
@spec advance(t(), non_neg_integer()) :: :ok
Advance virtual time by ms, firing due timers in deadline order. Timer
messages are sent before advance/2 returns, but delivery interleaving with
other senders is the receiver's mailbox order as usual.
@spec cancel_timer(t(), reference()) :: non_neg_integer() | false
Cancel a virtual timer. Returns remaining ms or false if already fired.
Returns a specification to start this module under a supervisor.
See Supervisor.
Current virtual monotonic time, milliseconds.
@spec send_after(t(), pid(), non_neg_integer(), term()) :: reference()
Arm a virtual timer; delivers {:timeout, ref, msg} to dest when due.