Belay.Clock.Sim (Belay v1.0.0)

Copy Markdown View Source

A settable, advanceable clock for deterministic tests.

Summary

Functions

Advance the simulated clock by a number of seconds.

Set the simulated clock to an exact value.

Start a simulated clock at start.

Functions

advance(pid, seconds)

@spec advance(Agent.agent(), number()) :: :ok

Advance the simulated clock by a number of seconds.

set(pid, at)

@spec set(Agent.agent(), DateTime.t()) :: :ok

Set the simulated clock to an exact value.

start_link(start \\ ~U[2026-01-01 00:00:00.000000Z])

@spec start_link(DateTime.t()) :: Agent.on_start()

Start a simulated clock at start.