ManualClock
A clock whose time moves only when a test calls advanceBy or advanceTo.
Inject it wherever code reads the time or sleeps through an abstraction you own, to make debouncing, retries, and expiry deterministic. It is a Clock (wall time starting at start), a TimeSource.WithComparableMarks (monotonic marks), and a millisecond source through currentTimeMillis, for code that takes clockMs: () -> Long.
Advancing resumes every sleeper whose deadline has been reached, in deadline order. Start the code under test, wait for it to suspend with waitForSleepers, then advance: advancing before a sleep registers does not wake it later. Each advance moves time directly to its target, so a coroutine that wakes and sleeps again measures its next deadline from the new time.
For code that uses delay directly, prefer runTest and its virtual time instead.
Parameters
The wall-clock instant reported before any advance.
Properties
Functions
Returns the current wall-clock time in epoch milliseconds.
Returns a mark at the current manual time.
Waits in real time until at least count coroutines are sleeping on this clock.