Skip to content

Commit b21c4a5

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 0ced9d5 commit b21c4a5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

imports.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ configured time zone.</p>
171171
<h5>Record Fields</h5>
172172
<ul>
173173
<li>
174-
<p><a name="timezone_display.utc_offset"></a><a href="#utc_offset"><code>utc-offset</code></a>: <code>s32</code></p>
175-
<p>The number of seconds difference between UTC time and the local
174+
<p><a name="timezone_display.utc_offset"></a><a href="#utc_offset"><code>utc-offset</code></a>: <code>s64</code></p>
175+
<p>The number of nanoseconds difference between UTC time and the local
176176
time of the timezone.
177-
<p>The returned value will always be less than 86400 which is the
178-
number of seconds in a day (24<em>60</em>60).</p>
177+
<p>The returned value will always be less than 86,400,000,000,000 which
178+
is the number of nanoseconds in a day (24<em>60</em>60*1e9).</p>
179179
<p>In implementations that do not expose an actual time zone, this
180180
should return 0.</p>
181181
</li>
@@ -216,5 +216,5 @@ time zone name.</p>
216216
</ul>
217217
<h5>Return values</h5>
218218
<ul>
219-
<li><a name="utc_offset.0"></a> <code>s32</code></li>
219+
<li><a name="utc_offset.0"></a> <code>s64</code></li>
220220
</ul>

wit/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)