Change the timezones to the match the city portion of the canonical IANA Zone IDs

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. Among other things, that clarifies which timezones do and do not have daylight savings.
This commit is contained in:
Michael Lenaghan 2023-07-26 16:04:39 -04:00
parent 8dbfb77890
commit 91a40f912b
13 changed files with 49 additions and 48 deletions

View file

@ -20,18 +20,19 @@
__static_yoink("zipos");
__static_yoink("usr/share/zoneinfo/");
__static_yoink("usr/share/zoneinfo/Anchorage");
__static_yoink("usr/share/zoneinfo/Beijing");
__static_yoink("usr/share/zoneinfo/Berlin");
__static_yoink("usr/share/zoneinfo/Boulder");
__static_yoink("usr/share/zoneinfo/Chicago");
__static_yoink("usr/share/zoneinfo/Denver");
__static_yoink("usr/share/zoneinfo/GMT");
__static_yoink("usr/share/zoneinfo/GST");
__static_yoink("usr/share/zoneinfo/Honolulu");
__static_yoink("usr/share/zoneinfo/Israel");
__static_yoink("usr/share/zoneinfo/Japan");
__static_yoink("usr/share/zoneinfo/Jerusalem");
__static_yoink("usr/share/zoneinfo/Kolkata");
__static_yoink("usr/share/zoneinfo/Los_Angeles");
__static_yoink("usr/share/zoneinfo/London");
__static_yoink("usr/share/zoneinfo/Melbourne");
__static_yoink("usr/share/zoneinfo/New_York");
__static_yoink("usr/share/zoneinfo/Shanghai");
__static_yoink("usr/share/zoneinfo/Sydney");
__static_yoink("usr/share/zoneinfo/Tokyo");
__static_yoink("usr/share/zoneinfo/UTC");
// clang-format off

View file

@ -24,7 +24,7 @@
#include "libc/time/time.h"
textstartup static void strftime_test_init(void) {
setenv("TZ", "GST", true);
setenv("TZ", "Los_Angeles", true);
}
const void *const strftime_test_ctor[] initarray = {strftime_test_init};
@ -58,20 +58,20 @@ TEST(strftime_100, rfc822_ShakaZuluTime) {
FormatTime("%a, %d %b %y %T %z", gmtime(&t)));
}
TEST(strftime_201, iso8601_GoogleStandardTime) {
TEST(strftime_201, iso8601_LosAngeles) {
int64_t t = 0x5cd04d0e;
ASSERT_STREQ("GST", getenv("TZ"));
ASSERT_STREQ("Los_Angeles", getenv("TZ"));
ASSERT_STREQ("2019-05-06T08:04:46PDT",
FormatTime("%Y-%m-%dT%H:%M:%S%Z", localtime(&t)));
}
TEST(strftime_201, rfc2822_GoogleStandardTime) {
TEST(strftime_201, rfc2822_LosAngeles) {
int64_t t = 0x5cd04d0e;
ASSERT_STREQ("Mon, 06 May 2019 08:04:46 -0700",
FormatTime("%a, %d %b %Y %T %z", localtime(&t)));
}
TEST(strftime_201, rfc822_GoogleStandardTime) {
TEST(strftime_201, rfc822_LosAngeles) {
int64_t t = 0x5cd04d0e;
ASSERT_STREQ("Mon, 06 May 19 08:04:46 -0700",
FormatTime("%a, %d %b %y %T %z", localtime(&t)));

View file

@ -295,20 +295,20 @@ class TimeTestCase(unittest.TestCase):
# http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap08.html
# They are also documented in the tzset(3) man page on most Unix
# systems.
# eastern = 'EST+05EDT,M4.1.0,M10.5.0' # [jart] wut
# victoria = 'AEST-10AEDT-11,M10.5.0,M3.5.0'
# new_york = 'EST+05EDT,M4.1.0,M10.5.0' # [jart] wut
# sydney = 'AEST-10AEDT-11,M10.5.0,M3.5.0'
# utc='UTC+0'
utc = 'UTC'
eastern = 'New_York'
victoria = 'Melbourne'
new_york = 'New_York'
sydney = 'Sydney'
org_TZ = environ.get('TZ',None)
try:
# Make sure we can switch to UTC time and results are correct
# Note that unknown timezones default to UTC.
# Note that altzone is undefined in UTC, as there is no DST
environ['TZ'] = eastern
environ['TZ'] = new_york
time.tzset()
environ['TZ'] = utc
time.tzset()
@ -320,7 +320,7 @@ class TimeTestCase(unittest.TestCase):
self.assertEqual(time.localtime(xmas2002).tm_isdst, 0)
# Make sure we can switch to US/Eastern
environ['TZ'] = eastern
environ['TZ'] = new_york
time.tzset()
self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002))
self.assertEqual(time.tzname, ('EST', 'EDT'))
@ -332,7 +332,7 @@ class TimeTestCase(unittest.TestCase):
self.assertEqual(len(time.tzname), 2)
# Now go to the southern hemisphere.
environ['TZ'] = victoria
environ['TZ'] = sydney
time.tzset()
self.assertNotEqual(time.gmtime(xmas2002), time.localtime(xmas2002))

View file

@ -7143,21 +7143,21 @@ function unix.gmtime(unixts) end
---
--- Your redbean ships with a subset of the time zone database.
---
--- - `/zip/usr/share/zoneinfo/Honolulu` Z-10
--- - `/zip/usr/share/zoneinfo/Anchorage` Z -9
--- - `/zip/usr/share/zoneinfo/GST` Z -8
--- - `/zip/usr/share/zoneinfo/Boulder` Z -6
--- - `/zip/usr/share/zoneinfo/Chicago` Z -5
--- - `/zip/usr/share/zoneinfo/New_York` Z -4
--- - `/zip/usr/share/zoneinfo/UTC` Z +0
--- - `/zip/usr/share/zoneinfo/GMT` Z +0
--- - `/zip/usr/share/zoneinfo/London` Z +1
--- - `/zip/usr/share/zoneinfo/Berlin` Z +2
--- - `/zip/usr/share/zoneinfo/Israel` Z +3
--- - `/zip/usr/share/zoneinfo/India` Z +5
--- - `/zip/usr/share/zoneinfo/Beijing` Z +8
--- - `/zip/usr/share/zoneinfo/Japan` Z +9
--- - `/zip/usr/share/zoneinfo/Sydney` Z+10
--- - `/zip/usr/share/zoneinfo/Honolulu` Z-10
--- - `/zip/usr/share/zoneinfo/Anchorage` Z-09/-08
--- - `/zip/usr/share/zoneinfo/Los_Angeles` Z-08/-07
--- - `/zip/usr/share/zoneinfo/Denver` Z-07/-06
--- - `/zip/usr/share/zoneinfo/Chicago` Z-06/-05
--- - `/zip/usr/share/zoneinfo/New_York` Z-05/-04
--- - `/zip/usr/share/zoneinfo/UTC` Z+00
--- - `/zip/usr/share/zoneinfo/GMT` Z+00
--- - `/zip/usr/share/zoneinfo/London` Z+00/+01
--- - `/zip/usr/share/zoneinfo/Berlin` Z+01/+02
--- - `/zip/usr/share/zoneinfo/Jerusalem` Z+02/+03
--- - `/zip/usr/share/zoneinfo/Kolkata` Z+05:30
--- - `/zip/usr/share/zoneinfo/Shanghai` Z+08
--- - `/zip/usr/share/zoneinfo/Tokyo` Z+09
--- - `/zip/usr/share/zoneinfo/Sydney` Z+10/+11
---
--- You can control which timezone is used using the `TZ` environment
--- variable. If your time zone isn't included in the above list, you

View file

@ -4604,21 +4604,21 @@ UNIX MODULE
Your redbean ships with a subset of the time zone database.
- `/zip/usr/share/zoneinfo/Honolulu` Z-10
- `/zip/usr/share/zoneinfo/Anchorage` Z -9
- `/zip/usr/share/zoneinfo/GST` Z -8
- `/zip/usr/share/zoneinfo/Boulder` Z -6
- `/zip/usr/share/zoneinfo/Chicago` Z -5
- `/zip/usr/share/zoneinfo/New_York` Z -4
- `/zip/usr/share/zoneinfo/UTC` Z +0
- `/zip/usr/share/zoneinfo/GMT` Z +0
- `/zip/usr/share/zoneinfo/London` Z +1
- `/zip/usr/share/zoneinfo/Berlin` Z +2
- `/zip/usr/share/zoneinfo/Israel` Z +3
- `/zip/usr/share/zoneinfo/India` Z +5
- `/zip/usr/share/zoneinfo/Beijing` Z +8
- `/zip/usr/share/zoneinfo/Japan` Z +9
- `/zip/usr/share/zoneinfo/Sydney` Z+10
- `/zip/usr/share/zoneinfo/Honolulu` Z-10
- `/zip/usr/share/zoneinfo/Anchorage` Z-09/-08
- `/zip/usr/share/zoneinfo/Los_Angeles` Z-08/-07
- `/zip/usr/share/zoneinfo/Denver` Z-07/-06
- `/zip/usr/share/zoneinfo/Chicago` Z-06/-05
- `/zip/usr/share/zoneinfo/New_York` Z-05/-04
- `/zip/usr/share/zoneinfo/UTC` Z+00
- `/zip/usr/share/zoneinfo/GMT` Z+00
- `/zip/usr/share/zoneinfo/London` Z+00/+01
- `/zip/usr/share/zoneinfo/Berlin` Z+01/+02
- `/zip/usr/share/zoneinfo/Jerusalem` Z+02/+03
- `/zip/usr/share/zoneinfo/Kolkata` Z+05:30
- `/zip/usr/share/zoneinfo/Shanghai` Z+08
- `/zip/usr/share/zoneinfo/Tokyo` Z+09
- `/zip/usr/share/zoneinfo/Sydney` Z+10/+11
You can control which timezone is used using the `TZ` environment
variable. If your time zone isn't included in the above list, you

Binary file not shown.

Binary file not shown.