-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document per-item versions using
@since
gates
- Loading branch information
1 parent
6cfb0f8
commit efeeb46
Showing
3 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,35 +7,42 @@ package wasi:[email protected]; | |
/// | ||
/// A monotonic clock is a clock which has an unspecified initial value, and | ||
/// successive reads of the clock will produce non-decreasing values. | ||
@since(version = 0.2.0) | ||
interface monotonic-clock { | ||
use wasi:io/poll@0.2.0.{pollable}; | ||
|
||
/// An instant in time, in nanoseconds. An instant is relative to an | ||
/// unspecified initial value, and can only be compared to instances from | ||
/// the same monotonic-clock. | ||
@since(version = 0.2.0) | ||
type instant = u64; | ||
|
||
/// A duration of time, in nanoseconds. | ||
@since(version = 0.2.0) | ||
type duration = 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. | ||
@since(version = 0.2.0) | ||
now: func() -> instant; | ||
|
||
/// Query the resolution of the clock. Returns the duration of time | ||
/// corresponding to a clock tick. | ||
@since(version = 0.2.0) | ||
resolution: func() -> duration; | ||
|
||
/// Create a `pollable` which will resolve once the specified instant | ||
/// has occurred. | ||
/// has occured. | ||
@since(version = 0.2.0) | ||
subscribe-instant: func( | ||
when: instant, | ||
) -> pollable; | ||
|
||
/// Create a `pollable` that will resolve after the specified duration has | ||
/// elapsed from the time this function is invoked. | ||
@since(version = 0.2.0) | ||
subscribe-duration: func( | ||
when: duration, | ||
) -> pollable; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,10 @@ package wasi:[email protected]; | |
/// monotonic, making it unsuitable for measuring elapsed time. | ||
/// | ||
/// It is intended for reporting the current date and time for humans. | ||
@since(version = 0.2.0) | ||
interface wall-clock { | ||
/// A time and date in seconds plus nanoseconds. | ||
@since(version = 0.2.0) | ||
record datetime { | ||
seconds: u64, | ||
nanoseconds: u32, | ||
|
@@ -33,10 +35,12 @@ interface wall-clock { | |
/// | ||
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 | ||
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time | ||
@since(version = 0.2.0) | ||
now: func() -> datetime; | ||
|
||
/// Query the resolution of the clock. | ||
/// | ||
/// The nanoseconds field of the output is always less than 1000000000. | ||
@since(version = 0.2.0) | ||
resolution: func() -> datetime; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
package wasi:clocks@0.2.0; | ||
|
||
@since(version = 0.2.0) | ||
world imports { | ||
@since(version = 0.2.0) | ||
import monotonic-clock; | ||
@since(version = 0.2.0) | ||
import wall-clock; | ||
} |