-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmonotonic-clock.wit
More file actions
32 lines (28 loc) · 1006 Bytes
/
Copy pathmonotonic-clock.wit
File metadata and controls
32 lines (28 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// 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.
///
/// It is intended for measuring elapsed time.
interface monotonic-clock {
use wasi:io/poll@0.2.0-rc-2023-10-18.{pollable};
/// A timestamp in nanoseconds.
type instant = u64;
/// Read the current value of the clock.
///
/// The clock is monotonic, therefore calling this function repeatedly will
/// produce a sequence of non-decreasing values.
now: func() -> instant;
/// Query the resolution of the clock.
resolution: func() -> instant;
/// Create a `pollable` which will resolve once the specified time has been
/// reached.
subscribe: func(
when: instant,
absolute: bool
) -> pollable;
}