mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 02:40:28 +00:00
Change the timezones to the match the canonical IANA Zone IDs
This commit is contained in:
parent
cc7187cd86
commit
639c459d6a
20 changed files with 82 additions and 57 deletions
|
@ -19,22 +19,26 @@
|
|||
|
||||
STATIC_YOINK("zipos");
|
||||
STATIC_YOINK("usr/share/zoneinfo/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Anchorage");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Berlin");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Chicago");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Denver");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/Anchorage");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/Chicago");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/Denver");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/Los_Angeles");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/New_York");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Asia/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Asia/Jerusalem");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Asia/Kolkata");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Asia/Shanghai");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Asia/Tokyo");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Australia/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Australia/Sydney");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Europe/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Europe/Berlin");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Europe/London");
|
||||
STATIC_YOINK("usr/share/zoneinfo/GMT");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Honolulu");
|
||||
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/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/Pacific/");
|
||||
STATIC_YOINK("usr/share/zoneinfo/Pacific/Honolulu");
|
||||
STATIC_YOINK("usr/share/zoneinfo/UTC");
|
||||
|
||||
// clang-format off
|
||||
/* Convert timestamp from time_t to struct tm. */
|
||||
/*
|
||||
|
|
|
@ -4,7 +4,13 @@
|
|||
PKGS += LIBC_TIME
|
||||
|
||||
LIBC_TIME_ARTIFACTS += LIBC_TIME_A
|
||||
LIBC_TIME_ZONEINFOS = $(wildcard usr/share/zoneinfo/*)
|
||||
LIBC_TIME_ZONEINFOS = \
|
||||
$(wildcard usr/share/zoneinfo/*) \
|
||||
$(wildcard usr/share/zoneinfo/America/*) \
|
||||
$(wildcard usr/share/zoneinfo/Asia/*) \
|
||||
$(wildcard usr/share/zoneinfo/Australia/*) \
|
||||
$(wildcard usr/share/zoneinfo/Europe/*) \
|
||||
$(wildcard usr/share/zoneinfo/Pacific/*)
|
||||
LIBC_TIME = $(LIBC_TIME_A_DEPS) $(LIBC_TIME_A)
|
||||
LIBC_TIME_A = o/$(MODE)/libc/time/time.a
|
||||
LIBC_TIME_A_FILES := $(wildcard libc/time/struct/*) $(wildcard libc/time/*)
|
||||
|
@ -18,6 +24,11 @@ LIBC_TIME_A_SRCS = \
|
|||
|
||||
LIBC_TIME_A_OBJS = \
|
||||
o/$(MODE)/usr/share/zoneinfo/.zip.o \
|
||||
o/$(MODE)/usr/share/zoneinfo/America/.zip.o \
|
||||
o/$(MODE)/usr/share/zoneinfo/Asia/.zip.o \
|
||||
o/$(MODE)/usr/share/zoneinfo/Australia/.zip.o \
|
||||
o/$(MODE)/usr/share/zoneinfo/Europe/.zip.o \
|
||||
o/$(MODE)/usr/share/zoneinfo/Pacific/.zip.o \
|
||||
$(LIBC_TIME_A_SRCS_S:%.S=o/$(MODE)/%.o) \
|
||||
$(LIBC_TIME_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||
$(LIBC_TIME_A_SRCS_C:%.c=o/$(MODE)/%.o) \
|
||||
|
@ -70,6 +81,16 @@ o/$(MODE)/libc/time/iso8601us.o: private \
|
|||
|
||||
o/$(MODE)/usr/share/zoneinfo/.zip.o: \
|
||||
usr/share/zoneinfo
|
||||
o/$(MODE)/usr/share/zoneinfo/America/.zip.o: \
|
||||
usr/share/zoneinfo/America
|
||||
o/$(MODE)/usr/share/zoneinfo/Asia/.zip.o: \
|
||||
usr/share/zoneinfo/Asia
|
||||
o/$(MODE)/usr/share/zoneinfo/Australia/.zip.o: \
|
||||
usr/share/zoneinfo/Australia
|
||||
o/$(MODE)/usr/share/zoneinfo/Europe/.zip.o: \
|
||||
usr/share/zoneinfo/Europe
|
||||
o/$(MODE)/usr/share/zoneinfo/Pacific/.zip.o: \
|
||||
usr/share/zoneinfo/Pacific
|
||||
|
||||
o/$(MODE)/libc/time/kmonthname.o: libc/time/kmonthname.S
|
||||
@$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) -c $<
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "libc/x/xiso8601.h"
|
||||
|
||||
STATIC_YOINK("zipos");
|
||||
STATIC_YOINK("usr/share/zoneinfo/New_York");
|
||||
STATIC_YOINK("usr/share/zoneinfo/America/New_York");
|
||||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
|
@ -142,7 +142,7 @@ TEST(dirstream, test) {
|
|||
|
||||
TEST(dirstream, zipTest) {
|
||||
bool foundNewYork = false;
|
||||
const char *path = "/zip/usr/share/zoneinfo/";
|
||||
const char *path = "/zip/usr/share/zoneinfo/America/";
|
||||
ASSERT_NE(0, _gc(xiso8601ts(NULL)));
|
||||
ASSERT_NE(NULL, (dir = opendir(path)));
|
||||
while ((ent = readdir(dir))) {
|
||||
|
@ -180,6 +180,6 @@ TEST(rewinddir, test) {
|
|||
}
|
||||
|
||||
TEST(dirstream, zipTest_notDir) {
|
||||
ASSERT_EQ(NULL, opendir("/zip/usr/share/zoneinfo/New_York"));
|
||||
ASSERT_EQ(NULL, opendir("/zip/usr/share/zoneinfo/America/New_York"));
|
||||
ASSERT_EQ(ENOTDIR, errno);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "libc/time/time.h"
|
||||
|
||||
textstartup static void strftime_test_init(void) {
|
||||
setenv("TZ", "Los_Angeles", true);
|
||||
setenv("TZ", "America/Los_Angeles", true);
|
||||
}
|
||||
const void *const strftime_test_ctor[] initarray = {strftime_test_init};
|
||||
|
||||
|
@ -60,7 +60,7 @@ TEST(strftime_100, rfc822_ShakaZuluTime) {
|
|||
|
||||
TEST(strftime_201, iso8601_LosAngeles) {
|
||||
int64_t t = 0x5cd04d0e;
|
||||
ASSERT_STREQ("Los_Angeles", getenv("TZ"));
|
||||
ASSERT_STREQ("America/Los_Angeles", getenv("TZ"));
|
||||
ASSERT_STREQ("2019-05-06T08:04:46PDT",
|
||||
FormatTime("%Y-%m-%dT%H:%M:%S%Z", localtime(&t)));
|
||||
}
|
||||
|
|
4
third_party/python/Lib/test/test_time.py
vendored
4
third_party/python/Lib/test/test_time.py
vendored
|
@ -300,8 +300,8 @@ class TimeTestCase(unittest.TestCase):
|
|||
# utc='UTC+0'
|
||||
|
||||
utc = 'UTC'
|
||||
new_york = 'New_York'
|
||||
sydney = 'Sydney'
|
||||
new_york = 'America/New_York'
|
||||
sydney = 'Australia/Sydney'
|
||||
|
||||
org_TZ = environ.get('TZ',None)
|
||||
try:
|
||||
|
|
|
@ -7071,21 +7071,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-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/Pacific/Honolulu` Z-10
|
||||
--- - `/zip/usr/share/zoneinfo/America/Anchorage` Z-09/-08
|
||||
--- - `/zip/usr/share/zoneinfo/America/Los_Angeles` Z-08/-07
|
||||
--- - `/zip/usr/share/zoneinfo/America/Denver` Z-07/-06
|
||||
--- - `/zip/usr/share/zoneinfo/America/Chicago` Z-06/-05
|
||||
--- - `/zip/usr/share/zoneinfo/America/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
|
||||
--- - `/zip/usr/share/zoneinfo/Europe/London` Z+00/+01
|
||||
--- - `/zip/usr/share/zoneinfo/Europe/Berlin` Z+01/+02
|
||||
--- - `/zip/usr/share/zoneinfo/Asia/Jerusalem` Z+02/+03
|
||||
--- - `/zip/usr/share/zoneinfo/Asia/Kolkata` Z+05:30
|
||||
--- - `/zip/usr/share/zoneinfo/Asia/Shanghai` Z+08
|
||||
--- - `/zip/usr/share/zoneinfo/Asia/Tokyo` Z+09
|
||||
--- - `/zip/usr/share/zoneinfo/Australia/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
|
||||
|
|
|
@ -4586,21 +4586,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-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/Pacific/Honolulu` Z-10
|
||||
- `/zip/usr/share/zoneinfo/America/Anchorage` Z-09/-08
|
||||
- `/zip/usr/share/zoneinfo/America/Los_Angeles` Z-08/-07
|
||||
- `/zip/usr/share/zoneinfo/America/Denver` Z-07/-06
|
||||
- `/zip/usr/share/zoneinfo/America/Chicago` Z-06/-05
|
||||
- `/zip/usr/share/zoneinfo/America/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
|
||||
- `/zip/usr/share/zoneinfo/Europe/London` Z+00/+01
|
||||
- `/zip/usr/share/zoneinfo/Europe/Berlin` Z+01/+02
|
||||
- `/zip/usr/share/zoneinfo/Asia/Jerusalem` Z+02/+03
|
||||
- `/zip/usr/share/zoneinfo/Asia/Kolkata` Z+05:30
|
||||
- `/zip/usr/share/zoneinfo/Asia/Shanghai` Z+08
|
||||
- `/zip/usr/share/zoneinfo/Asia/Tokyo` Z+09
|
||||
- `/zip/usr/share/zoneinfo/Australia/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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue