WasiClock
1 type2 values2 functionsThe host's clocks, read in nanoseconds, over wasi:clocks. realtime
tells the time of day; monotonic measures how long
something took, since it never goes backwards. The wasip1 package's
WasiClock has the same names, but its now and resolution answer a
Result, because a preview 1 host can refuse a clock; a WASI 0.2 host
cannot, so these answer the number itself.
At a glance
Types
@Clock
Which of the host's clocks to read. Opaque: only this module builds one.
Values
realtime
Wall-clock time: nanoseconds since the Unix epoch, which the host may move.
monotonic
A clock that never goes backwards, from an unspecified origin: for measuring how long something took, not for telling the time.
Functions
now
Nanoseconds. now(realtime) is wall-clock time since the Unix epoch;
now(monotonic) counts from an unspecified origin and never goes backwards.
Wall-clock time overflows an Int in the year 2262.
resolution
The clock's tick length, in nanoseconds.