cosmopolitan
cosmopolitan copied to clipboard
Change the timezones to match the canonical IANA Zone IDs
This is a superset of the previous pull request. Rather than changing timezones to the match the city portion of the canonical IANA Zone IDs, this changes them to match the actual Zone ID. In my opinion, that's better — see, for example, this.
I split this into its own pull request because it might be more controversial.
You could accept the previous one, and then accept this one on top of it, or you could accept only this one. It depends on what kind of history you want. Assuming, that is, that you want to accept this change at all. :-)
Since this pull request could be accepted without that one, I'll copy the detailed explanation from that pull request.
P.S. I think the only controversial bit is the way I added the timezones in libc\time\time.mk; in terms of regions, I went the explicit route rather than the pattern route. Patterns over directories… Hmmm.
===
This renames the following Zone IDs:
- Beijing -> Shangai
- Boulder -> Denver
- GST -> Los_Angeles
- India -> Kolkata
- Israel -> Jerusalem
- Japan -> Tokyo
The new names are the city portion of the canonical Zone ID for each zone. (See https://nodatime.org/TimeZones for a complete list of canonical Zone IDs from IANA 2023c.)
The most important change is “GST -> Los_Angeles”. In the code, “GST” was taken to mean “Google Standard Time”, but it already means something else: “Gulf Standard Time” (https://www.timeanddate.com/time/zones/gst).
In addition:
- The India zoneinfo file wasn’t YOINKed; now it is, under the name Kolkata
- The Melbourne zoneinfo file was YOINKed; it was deleted in favor of an already-existing un-YOINKed Sydney file
- The Singapore zoneinfo file wasn’t YOINKed; it was deleted
(Melbourne is in the same timezone as Sydney. Singapore is in the same timezone as Shanghai. But note that “same timezone” is misleading, since when the standard time/daylight savings time shift happens is a political question.)
Finally, the offsets in the docs were a mixture of standard time and daylight savings time. Now both offsets are given. The first is always the standard time offset. The second, if applicable, is the daylight savings offset.
Forgot to mention that checked all TZs by hand:
~/W/P/t/cosmopolitan (patch-3)> TZ="GMT" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 21 38 39 0 3 206 0 GMT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Pacific/Honolulu" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 11 38 53 -36000 3 206 0 HST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="America/Anchorage" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 13 39 7 -28800 3 206 1 AKDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="America/Los_Angeles" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 14 39 18 -25200 3 206 1 PDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="America/Denver" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 15 39 34 -21600 3 206 1 MDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="America/Chicago" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 16 39 48 -18000 3 206 1 CDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="America/New_York" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 17 40 0 -14400 3 206 1 EDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Europe/London" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 22 40 13 3600 3 206 1 BST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Europe/Berlin" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 26 23 40 24 7200 3 206 1 CEST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Asia/Jerusalem" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 27 0 40 34 10800 4 207 1 IDT
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Asia/Kolkata" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 27 3 10 45 19800 4 207 0 IST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Asia/Shanghai" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 27 5 41 9 28800 4 207 0 CST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Asia/Tokyo" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 27 6 41 22 32400 4 207 0 JST
~/W/P/t/cosmopolitan (patch-3.1)> TZ="Australia/Sydney" ./o/tool/net/redbean.com -i -e "print(unix.localtime(unix.clock_gettime()))"
2023 7 27 7 41 35 36000 4 207 0 AEST
#1049 is somewhat related to this change
#1049 is somewhat related to this change
@bjconlan The actual fix for #1049 is in PR #869
Should be fixed as of b0df6c1fce30086bb2cefdd0079392fc2ad80edd. Thank you for bringing this to our attention @michaellenaghan.