Skip to content

Commit c91853b

Browse files
committed
Move Unix Time docs to instant type
Instead of only specifying the epoch of the instant returned from now(), specify the epoch of the instant type. It then follows that now() returns an instant with that epoch.
1 parent b576c76 commit c91853b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

wit-0.3.0-draft/system-clock.wit

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ interface system-clock {
1414
/// An "instant", or "exact time", is a point in time without regard to any
1515
/// time zone: just the time since a particular external reference point,
1616
/// often called an "epoch".
17+
///
18+
/// Here, the epoch is 1970-01-01T00:00:00Z, also known as
19+
/// [POSIX's Seconds Since the Epoch], also known as [Unix Time].
20+
///
1721
/// Note that even if the seconds field is negative, incrementing
1822
/// nanoseconds always represents moving forwards in time.
1923
/// For example, `{ -1 seconds, 999999999 nanoseconds }` represents the
2024
/// instant one nanosecond before the epoch.
2125
/// For more on various different ways to represent time, see
2226
/// https://tc39.es/proposal-temporal/docs/timezone.html
27+
///
28+
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
29+
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
2330
@since(version = 0.3.0)
2431
record instant {
2532
seconds: s64,
@@ -38,14 +45,7 @@ interface system-clock {
3845
/// This clock is not monotonic, therefore calling this function repeatedly
3946
/// will not necessarily produce a sequence of non-decreasing values.
4047
///
41-
/// The returned timestamps represent the number of seconds since
42-
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
43-
/// also known as [Unix Time].
44-
///
4548
/// The nanoseconds field of the output is always less than 1000000000.
46-
///
47-
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
48-
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
4949
@since(version = 0.3.0)
5050
now: func() -> instant;
5151

0 commit comments

Comments
 (0)