Skip to content

Commit 30a6a4d

Browse files
committed
Measure UTC offset in nanoseconds
There are time zones that used sub-minute or even sub-second UTC offsets for instants in the past. E.g., when built using Vanguard format, the UTC offset in the TZDB for "Asia/Ho_Chi_Minh" before July 1906 is 7:06:30.133333333.
1 parent 18a7705 commit 30a6a4d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

wit-0.3.0-draft/timezone.wit

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ interface timezone {
1616

1717
/// The same as `display`, but only return the UTC offset.
1818
@unstable(feature = clocks-timezone)
19-
utc-offset: func(when: instant) -> s32;
19+
utc-offset: func(when: instant) -> s64;
2020

2121
/// Information useful for displaying a specific `instant` in the currently
2222
/// configured time zone.
2323
@unstable(feature = clocks-timezone)
2424
record timezone-display {
25-
/// The number of seconds difference between UTC time and the local
25+
/// The number of nanoseconds difference between UTC time and the local
2626
/// time of the timezone.
2727
///
28-
/// The returned value will always be less than 86400 which is the
29-
/// number of seconds in a day (24*60*60).
28+
/// The returned value will always be less than 86,400,000,000,000 which
29+
/// is the number of nanoseconds in a day (24*60*60*1e9).
3030
///
3131
/// In implementations that do not expose an actual time zone, this
3232
/// should return 0.
33-
utc-offset: s32,
33+
utc-offset: s64,
3434

3535
/// The IANA identifier of the timezone. The id `UTC` indicates
3636
/// Coordinated Universal Time. Otherwise, this should be an identifier

0 commit comments

Comments
 (0)