time
include "time";
Clocks and timers: wait for a while, measure how much time has passed, and read the current UTC date and time.
Functions
timer_after
fn timer_after(float seconds)
Completes after at least seconds on the host timer clock. Branch it to wait concurrently.
timer_now infallible
infallible fn timer_now() -> float
The current time, in seconds, of the host clock that drives timer_after. Compare readings; the epoch is the host's choice.
monotonic_now infallible
infallible fn monotonic_now() -> float
The platform's high-resolution monotonic clock, in seconds. Use it to measure elapsed time.
clock_utc_into
fn clock_utc_into(buffer output) -> int
Writes the UTC time as YYYY-MM-DDTHH:MM:SSZ into output; returns the byte count.
deadline infallible
infallible fn deadline(float at) -> channel<bool>
A channel that is closed once timer_now() reaches at. A closed channel is
ready for every waiter, so one deadline can guard many waits:
join t unless deadline(at).
timeout infallible
infallible fn timeout(float seconds) -> channel<bool>
A channel that is closed after at least seconds on the timer clock; see deadline.