From ba32084f08d4dcf11430816d53f467837c8d01a5 Mon Sep 17 00:00:00 2001 From: Christopher Wong Date: Thu, 28 Feb 2019 14:22:42 +0100 Subject: [PATCH 1/3] Use new time zone list When systemd retrieve the time zone it read what is in the file /usr/share/zoneinfo/zone.tab provided by the Time Zone Database. According to the comments in zone.tab its content is for backward- compatibility aid for older programs. New programs should use zone1970.tab. This patch replaces zone.tab with zone1970.tab. --- src/basic/time-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 25a5c116e89..daf952baa11 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -1214,7 +1214,7 @@ int get_timezones(char ***ret) { n_allocated = 2; n_zones = 1; - f = fopen("/usr/share/zoneinfo/zone.tab", "re"); + f = fopen("/usr/share/zoneinfo/zone1970.tab", "re"); if (f) { for (;;) { _cleanup_free_ char *line = NULL; From 781748af45b4ba727268ffc48f5af6b3a1e9f54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 28 Feb 2019 15:37:06 +0100 Subject: [PATCH 2/3] README: mention that we need tzdata >= 2014f zone1970.tab was added in that version. Not that it makes sense to use outdata timezone tables, but people do strange things. C.f. https://github.com/nodatime/nodatime/issues/319. --- README | 1 + 1 file changed, 1 insertion(+) diff --git a/README b/README index 9cc491e8061..c6523193fab 100644 --- a/README +++ b/README @@ -158,6 +158,7 @@ REQUIREMENTS: openssl >= 1.1.0 (optional, required to support DNS-over-TLS with openssl) elfutils >= 158 (optional) polkit (optional) + tzdata >= 2014f (optional) pkg-config gperf docbook-xsl (optional, required for documentation) From f0e2e0db0030f03172f9a04634042e3a6a1b169f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 28 Feb 2019 15:38:16 +0100 Subject: [PATCH 3/3] test-time-util: use standard intro and print timezones read from file The asserts are OK, but it's also nice to see the list by eye. --- src/test/test-time-util.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c index 633544ff2e1..d05bb614290 100644 --- a/src/test/test-time-util.c +++ b/src/test/test-time-util.c @@ -4,6 +4,7 @@ #include "serialize.h" #include "string-util.h" #include "strv.h" +#include "tests.h" #include "time-util.h" static void test_parse_sec(void) { @@ -260,8 +261,10 @@ static void test_get_timezones(void) { r = get_timezones(&zones); assert_se(r == 0); - STRV_FOREACH(zone, zones) + STRV_FOREACH(zone, zones) { + log_info("zone: %s", *zone); assert_se(timezone_is_valid(*zone, LOG_ERR)); + } } static void test_usec_add(void) { @@ -481,7 +484,7 @@ static void test_in_utc_timezone(void) { } int main(int argc, char *argv[]) { - uintmax_t x; + test_setup_logging(LOG_INFO); log_info("realtime=" USEC_FMT "\n" "monotonic=" USEC_FMT "\n" @@ -513,7 +516,7 @@ int main(int argc, char *argv[]) { assert_cc((time_t) -1 < (time_t) 1); /* Ensure TIME_T_MAX works correctly */ - x = (uintmax_t) TIME_T_MAX; + uintmax_t x = TIME_T_MAX; x++; assert((time_t) x < 0);