From f0245e33f566c31cd5fca3f7ee90566f89f3ece7 Mon Sep 17 00:00:00 2001
From: Yosh
Date: Tue, 28 May 2024 14:20:09 +0200
Subject: [PATCH 1/3] Document per-item versions using `@since` gates
---
wit/monotonic-clock.wit | 9 ++++++++-
wit/wall-clock.wit | 4 ++++
wit/world.wit | 3 +++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/wit/monotonic-clock.wit b/wit/monotonic-clock.wit
index a242b41..f7888bc 100644
--- a/wit/monotonic-clock.wit
+++ b/wit/monotonic-clock.wit
@@ -7,35 +7,42 @@ package wasi:clocks@0.2.0;
///
/// 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;
diff --git a/wit/wall-clock.wit b/wit/wall-clock.wit
index 440ca0f..4b08d71 100644
--- a/wit/wall-clock.wit
+++ b/wit/wall-clock.wit
@@ -13,8 +13,10 @@ package wasi:clocks@0.2.0;
/// 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;
}
diff --git a/wit/world.wit b/wit/world.wit
index b76a005..76a9206 100644
--- a/wit/world.wit
+++ b/wit/world.wit
@@ -1,7 +1,10 @@
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;
@unstable(feature = clocks-timezone)
import timezone;
From 80874892a656f1c491b138aa3dde9c356af0799f Mon Sep 17 00:00:00 2001
From: Yosh
Date: Fri, 21 Jun 2024 02:10:26 +0200
Subject: [PATCH 2/3] annotate `use` statements
---
wit/monotonic-clock.wit | 1 +
1 file changed, 1 insertion(+)
diff --git a/wit/monotonic-clock.wit b/wit/monotonic-clock.wit
index f7888bc..cae2363 100644
--- a/wit/monotonic-clock.wit
+++ b/wit/monotonic-clock.wit
@@ -9,6 +9,7 @@ package wasi:clocks@0.2.0;
/// successive reads of the clock will produce non-decreasing values.
@since(version = 0.2.0)
interface monotonic-clock {
+ @since(version = 0.2.0)
use wasi:io/poll@0.2.0.{pollable};
/// An instant in time, in nanoseconds. An instant is relative to an
From 56ebb81ce71c01b163c02e2803f37215a324145d Mon Sep 17 00:00:00 2001
From: Yosh
Date: Fri, 28 Jun 2024 18:07:55 +0200
Subject: [PATCH 3/3] Update imports.md
---
imports.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/imports.md b/imports.md
index b1fefd7..8b977ac 100644
--- a/imports.md
+++ b/imports.md
@@ -98,7 +98,7 @@ corresponding to a clock tick.
subscribe-instant: func
Create a pollable
which will resolve once the specified instant
-has occurred.
+has occured.
Params