Skip to content

Commit c8c3316

Browse files
committed
Make timezone-display::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 f77f01b commit c8c3316

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
@@ -172,11 +172,11 @@ saving time adjustments.</p>
172172
<h5>Record Fields</h5>
173173
<ul>
174174
<li>
175-
<p><a name="timezone_display.utc_offset"></a><a href="#utc_offset"><code>utc-offset</code></a>: <code>s32</code></p>
176-
<p>The number of seconds difference between UTC time and the local
175+
<p><a name="timezone_display.utc_offset"></a><a href="#utc_offset"><code>utc-offset</code></a>: <code>s64</code></p>
176+
<p>The number of nanoseconds difference between UTC time and the local
177177
time of the timezone.
178-
<p>The returned value will always be less than 86400 which is the
179-
number of seconds in a day (24<em>60</em>60).</p>
178+
<p>The returned value will always be less than 86,400,000,000,000 which
179+
is the number of nanoseconds in a day (24<em>60</em>60*1e9).</p>
180180
<p>In implementations that do not expose an actual time zone, this
181181
should return 0.</p>
182182
</li>
@@ -216,5 +216,5 @@ the UTC offset and the 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
@@ -15,23 +15,23 @@ interface timezone {
1515

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

2020
/// Information useful for displaying the timezone of a specific `instant`.
2121
///
2222
/// This information may vary within a single `timezone` to reflect daylight
2323
/// saving time adjustments.
2424
@unstable(feature = clocks-timezone)
2525
record timezone-display {
26-
/// The number of seconds difference between UTC time and the local
26+
/// The number of nanoseconds difference between UTC time and the local
2727
/// time of the timezone.
2828
///
29-
/// The returned value will always be less than 86400 which is the
30-
/// number of seconds in a day (24*60*60).
29+
/// The returned value will always be less than 86,400,000,000,000 which
30+
/// is the number of nanoseconds in a day (24*60*60*1e9).
3131
///
3232
/// In implementations that do not expose an actual time zone, this
3333
/// should return 0.
34-
utc-offset: s32,
34+
utc-offset: s64,
3535

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

0 commit comments

Comments
 (0)