Skip to content
docsv0.12.0

Clock

Time as an INPUT, not a hidden call. A component or runtime that stamps time reads it from an injected {@see Clock} rather than calling `date()`/`time()` inside its logic, so the same inputs and the same clock produce the same output — the determinism a replay needs (greenhouse decisions/0102/0103; the gap ResearchLabs surfaced when its ActorRuntime used a wall clock). Implementations: a wall clock and a fixed, reproducible one live in {@see \Milpa\Support\SystemClock} and {@see \Milpa\Support\FixedClock}.

Clock::now()

abstract public function now(): string

The current instant as an ISO-8601 string (the shape a document/state stamps).

Clock::instant()

abstract public function instant(): DateTimeImmutable

The same instant as a {@see \DateTimeImmutable} — the shape a domain runtime compares and formats (the ResearchLabs ActorRuntime wanted this; a string was too lossy, so it forked its own port). A consistent clock derives {@see now()} and {@see instant()} from the same source (greenhouse decisions/0131).