Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions wit-0.3.0-draft/deps.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[clocks]
url = "https://github.com/WebAssembly/wasi-clocks/archive/main.tar.gz"
subdir = "wit-0.3.0-draft"
sha256 = "626953ec28ae956ec1233c4350deab6e5cdcbdd9ae6d491e102ad7c6901cc8bf"
sha512 = "ae375b002cfaacdbaa133bb87747d1b86675e13144067c3005d6c32cf5c37bb7a52b693ae46d5cd65fc4910a78d7255d0ada5142828a022497fd0eaacb61761f"
sha256 = "cf61a3785c2838340ce530ee1cdc6dbee3257f1672d6000ca748dfe253808dec"
sha512 = "f647de7d6c470595c3e5bf0dba6af98703beb9f701c66543cea5d42e81f7a1a73f199c3949035a9c2c1bd717056e5e68788f520af39b9d26480242b7626f22ce"
27 changes: 15 additions & 12 deletions wit-0.3.0-draft/deps/clocks/monotonic-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.3.0-rc-2025-08-15;
package wasi:clocks@0.3.0-rc-2025-09-16;
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
Expand All @@ -7,38 +7,41 @@ package wasi:clocks@0.3.0-rc-2025-08-15;
///
/// 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.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
interface monotonic-clock {
use types.{duration};

/// 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.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
type instant = u64;

/// A duration of time, in nanoseconds.
@since(version = 0.3.0-rc-2025-08-15)
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.3.0-rc-2025-08-15)
///
/// For completeness, this function traps if it's not possible to represent
/// the value of the clock in an `instant`. Consequently, implementations
/// should ensure that the starting time is low enough to avoid the
/// possibility of overflow in practice.
@since(version = 0.3.0-rc-2025-09-16)
now: func() -> instant;

/// Query the resolution of the clock. Returns the duration of time
/// corresponding to a clock tick.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> duration;

/// Wait until the specified instant has occurred.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
wait-until: async func(
when: instant,
);

/// Wait for the specified duration has elapsed.
@since(version = 0.3.0-rc-2025-08-15)
/// Wait for the specified duration to elapse.
@since(version = 0.3.0-rc-2025-09-16)
wait-for: async func(
how-long: duration,
);
Expand Down
2 changes: 1 addition & 1 deletion wit-0.3.0-draft/deps/clocks/timezone.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.3.0-rc-2025-08-15;
package wasi:clocks@0.3.0-rc-2025-09-16;

@unstable(feature = clocks-timezone)
interface timezone {
Expand Down
8 changes: 8 additions & 0 deletions wit-0.3.0-draft/deps/clocks/types.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package wasi:clocks@0.3.0-rc-2025-09-16;
/// This interface common types used throughout wasi:clocks.
@since(version = 0.3.0-rc-2025-09-16)
interface types {
/// A duration of time, in nanoseconds.
@since(version = 0.3.0-rc-2025-09-16)
type duration = u64;
}
10 changes: 5 additions & 5 deletions wit-0.3.0-draft/deps/clocks/wall-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.3.0-rc-2025-08-15;
package wasi:clocks@0.3.0-rc-2025-09-16;
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
Expand All @@ -13,10 +13,10 @@ package wasi:clocks@0.3.0-rc-2025-08-15;
/// monotonic, making it unsuitable for measuring elapsed time.
///
/// It is intended for reporting the current date and time for humans.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
interface wall-clock {
/// A time and date in seconds plus nanoseconds.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
record datetime {
seconds: u64,
nanoseconds: u32,
Expand All @@ -35,12 +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.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
now: func() -> datetime;

/// Query the resolution of the clock.
///
/// The nanoseconds field of the output is always less than 1000000000.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
get-resolution: func() -> datetime;
}
8 changes: 4 additions & 4 deletions wit-0.3.0-draft/deps/clocks/world.wit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package wasi:clocks@0.3.0-rc-2025-08-15;
package wasi:clocks@0.3.0-rc-2025-09-16;

@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
world imports {
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
import monotonic-clock;
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
import wall-clock;
@unstable(feature = clocks-timezone)
import timezone;
Expand Down
8 changes: 4 additions & 4 deletions wit-0.3.0-draft/ip-name-lookup.wit
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
interface ip-name-lookup {
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
use types.{ip-address};

/// Lookup error codes.
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
enum error-code {
/// Unknown error
unknown,
Expand Down Expand Up @@ -57,6 +57,6 @@ interface ip-name-lookup {
/// - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
/// - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
/// - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
@since(version = 0.3.0-rc-2025-08-15)
@since(version = 0.3.0-rc-2025-09-16)
resolve-addresses: async func(name: string) -> result<list<ip-address>, error-code>;
}
Loading