@@ -3,53 +3,44 @@ package wasi:clocks@0.3.0-rc-2025-09-16;
33@unstable (feature = clocks-timezone )
44interface timezone {
55 @unstable (feature = clocks-timezone )
6- use wall -clock. {datetime };
6+ use system -clock. {instant };
77
8- /// Return information needed to display the given `datetime` . This includes
9- /// the UTC offset, the time zone name, and a flag indicating whether
10- /// daylight saving time is active.
8+ /// Return the IANA identifier of the currently configured timezone. This
9+ /// should be an identifier from the IANA Time Zone Database.
1110 ///
12- /// If the timezone cannot be determined for the given `datetime` , return a
13- /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
14- /// saving time.
11+ /// For displaying to a user, the identifier should be converted into a
12+ /// localized name by means of an internationalization API.
13+ ///
14+ /// If the implementation does not expose an actual timezone, or is unable
15+ /// to provide mappings from times to deltas between the configured timezone
16+ /// and UTC, or determining the current timezone fails, or the timezone does
17+ /// not have an IANA identifier, this returns nothing.
1518 @unstable (feature = clocks-timezone )
16- display : func (when : datetime ) -> timezone-display ;
19+ iana-id : func () -> option < string > ;
1720
18- /// The same as `display` , but only return the UTC offset.
21+ /// The number of nanoseconds difference between UTC time and the local
22+ /// time of the currently configured timezone, at the exact time of
23+ /// `instant` .
24+ ///
25+ /// The magnitude of the returned value will always be less than
26+ /// 86,400,000,000,000 which is the number of nanoseconds in a day
27+ /// (24*60* 60*1e9).
28+ ///
29+ /// If the implementation does not expose an actual timezone, or is unable
30+ /// to provide mappings from times to deltas between the configured timezone
31+ /// and UTC, or determining the current timezone fails, this returns
32+ /// nothing.
1933 @unstable (feature = clocks-timezone )
20- utc-offset : func (when : datetime ) -> s32 ;
34+ utc-offset : func (when : instant ) -> option < s64 > ;
2135
22- /// Information useful for displaying the timezone of a specific `datetime` .
36+ /// Returns a string that is suitable to assist humans in debugging whether
37+ /// any timezone is available, and if so, which. This may be the same string
38+ /// as `iana-id` , or a formatted representation of the UTC offset such as
39+ /// `-04:00` , or something else.
2340 ///
24- /// This information may vary within a single `timezone` to reflect daylight
25- /// saving time adjustments.
41+ /// WARNING: The returned string should not be consumed mechanically! It may
42+ /// change across platforms, hosts, or other implementation details. Parsing
43+ /// this string is a major platform-compatibility hazard.
2644 @unstable (feature = clocks-timezone )
27- record timezone-display {
28- /// The number of seconds difference between UTC time and the local
29- /// time of the timezone.
30- ///
31- /// The returned value will always be less than 86400 which is the
32- /// number of seconds in a day (24*60* 60).
33- ///
34- /// In implementations that do not expose an actual time zone, this
35- /// should return 0.
36- utc-offset : s32 ,
37-
38- /// The abbreviated name of the timezone to display to a user. The name
39- /// `UTC` indicates Coordinated Universal Time. Otherwise, this should
40- /// reference local standards for the name of the time zone.
41- ///
42- /// In implementations that do not expose an actual time zone, this
43- /// should be the string `UTC` .
44- ///
45- /// In time zones that do not have an applicable name, a formatted
46- /// representation of the UTC offset may be returned, such as `-04:00` .
47- name : string ,
48-
49- /// Whether daylight saving time is active.
50- ///
51- /// In implementations that do not expose an actual time zone, this
52- /// should return false.
53- in-daylight-saving-time : bool ,
54- }
45+ to-debug-string : func () -> string ;
5546}
0 commit comments