Module time

Source
Expand description

Async timekeeping

See Timer, Periodic, and timeout.

§Precision

There’s a limit on the precision of the timers, depending on the platform. For example, on Unix platforms without timerfd support, the maximum precision is 1 millisecond. This can lead to the timer sleeping for longer than the requested duration, but it will never sleep for less.

Structs§

Periodic
Periodic async timer that fires at an interval.
TimedOut
Error returned from timeout
Timeout
Future produced by timeout
Timer
One-shot async timer.

Functions§

sleep
Sleep asynchronously for a set duration
timeout
Run the future with a timeout, cancelling it if it doesn’t complete in time.
timeout_at
Run the future until a point in time, cancelling it if it doesn’t complete in time.