time
The time module provides UTC date/time instants, signed durations, sleeping,
and scoped timeouts.
Functions
sleep duration
Suspends the current strand.
Parameters
| Name | Type | Description |
|---|---|---|
duration |
Duration | Int | Float |
Sleep duration. Numeric values are interpreted as seconds. |
Notes:
- Duration must be non-negative.
- Floating-point values must be finite.
timeout duration block
Runs block with a scoped timeout.
Parameters
| Name | Type | Description |
|---|---|---|
duration |
Duration | Int | Float |
Timeout duration. Numeric values are interpreted as seconds. |
block |
Func |
Block to run under the timeout scope. |
Returns
block result
Errors
| Exception | Condition |
|---|---|
TimedOutError |
The timeout is observed at a suspend or interrupt-check point before the block completes |