VirtualClock class final

A deterministic virtual clock. Never touches DateTime.now().

Constructors

VirtualClock(int seed)
Construct a clock whose epoch is deterministically derived from seed (stable across platforms: pure integer arithmetic, no wall-clock anchoring).
VirtualClock.atEpoch(int epochMs)
Construct a clock pinned to an explicit epoch (tests).

Properties

elapsedMs int
Virtual milliseconds elapsed since the clock's epoch.
no setter
epochMs int
final
hashCode int
The hash code for this object.
no setterinherited
nowIso String
The current virtual time as an ISO-8601 UTC instant.
no setter
nowMs int
The current virtual time (milliseconds since the Unix epoch).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

advance(int ms) int
Advance virtual time by ms (negative values are clamped to 0 — time only moves forward). Returns the new nowMs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited