sleep_ms
fn sleep_ms(int ms) Import
Source: use clock::{sleep_ms}; compiler/src/builtin_docs/clock.hy Pauses for at least ms milliseconds.
Zero or a negative value returns at once. Outside a task::scope this
blocks the thread; inside one it suspends only the calling task, so
other tasks keep running.
Parameters#
| Name | Type |
|---|---|
ms | int |
Examples#
use clock::{sleep_ms, mono_nanos};
use tests::assert;
let start = mono_nanos();
sleep_ms(10);
assert!(mono_nanos() - start >= 10000000);
See also#
task::scopewall_nanos: Returns the current wall-clock time in nanoseconds since the Unix epoch (UTC).mono_nanos: Returns monotonic nanoseconds from a process-local starting point.