Module spin_sdk.wit.imports.wasi_clocks_monotonic_clock_0_3_0
WASI Monotonic Clock is a clock API intended to let users measure elapsed time.
It is intended to be portable at least between Unix-family platforms and Windows.
A monotonic clock is a clock which has an unspecified initial value, and successive reads of the clock will produce non-decreasing values.
Functions
def get_resolution() ‑> int-
Expand source code
def get_resolution() -> int: """ Query the resolution of the clock. Returns the duration of time corresponding to a clock tick. """ raise NotImplementedErrorQuery the resolution of the clock. Returns the duration of time corresponding to a clock tick.
def now() ‑> int-
Expand source code
def now() -> int: """ Read the current value of the clock. The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values. For completeness, this function traps if it's not possible to represent the value of the clock in a `mark`. Consequently, implementations should ensure that the starting time is low enough to avoid the possibility of overflow in practice. """ raise NotImplementedErrorRead the current value of the clock.
The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values.
For completeness, this function traps if it's not possible to represent the value of the clock in a
mark. Consequently, implementations should ensure that the starting time is low enough to avoid the possibility of overflow in practice. async def wait_for(how_long: int) ‑> None-
Expand source code
async def wait_for(how_long: int) -> None: """ Wait for the specified duration to elapse. """ raise NotImplementedErrorWait for the specified duration to elapse.
async def wait_until(when: int) ‑> None-
Expand source code
async def wait_until(when: int) -> None: """ Wait until the specified mark has occurred. """ raise NotImplementedErrorWait until the specified mark has occurred.