Expand description
clock: monotonic time, and waiting.
The Language Card lists the clock among the operations that are typed Host
APIs rather than ambient authority, and says a host “may provide real,
fake, filtered, remote, or denied implementations”. This module is where
that becomes two implementations of one Host API: Clock::real reads the
platform’s monotonic clock, and Clock::virtual_clock reads a counter
that moves only when the host moves it. Cove code cannot tell them apart,
which is what makes a program that observes time testable.
Time is a Duration since an origin the host picks, never a wall-clock
date. A Duration subtracts, so clock.now() - startedAt is the elapsed
time of a piece of work, and no program can accidentally depend on the
origin itself.
Structs§
- Clock
clock: how much time has passed, and waiting for more of it to pass.- Virtual
Time - The current time of a virtual clock, shared between the host and whoever moves it.