From 025c4bd0221016eab286ba9aac0640cecf4560a1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 15 Oct 2022 19:10:57 -0700 Subject: [PROPOSED 1/5] =?UTF-8?q?Move=20a=20few=20links=20to=20=E2=80=98b?= =?UTF-8?q?ackward=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a Link is just an alternate name, it’s not needed for zone.tab and ‘backward’ is a better home for it anyway. This helps improve link checking. * Makefile (check_links): Use new backcheck option. * asia (Europe/Nicosia): * etcetera (Etc/Universal, Etc/Zulu, Etc/Greenwich, Etc/GMT-0) (Etc/GMT+0, Etc/GMT0): * europe (Asia/Istanbul): Move Link to ‘backward’. * checklinks.awk: Add backcheck option, to check that non-‘backward’ Links are next to the Zones they link to, and that a Link is in a continental file if and only if it is in zone.tab. Add a special case for GMT. * etcetera (GMT): In vanguard form, now a Zone, not a Link, since it’s the file the leap second code depends on. (Etc/GMT): In vanguard form, now a link in ‘backward’ instead of a Zone here. * ziguard.awk: Support the vanguard form. --- Makefile | 3 ++- NEWS | 12 ++++++++++++ asia | 4 ---- backward | 26 ++++++++++++++++++++++++++ checklinks.awk | 27 +++++++++++++++++++++++++++ etcetera | 17 +++++++---------- europe | 1 - theory.html | 1 + zdump.c | 4 ++-- ziguard.awk | 14 ++++++++++++++ 10 files changed, 91 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 79940f7..20a8016 100644 --- a/Makefile +++ b/Makefile @@ -825,7 +825,8 @@ check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab touch $@ check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi - $(AWK) -f checklinks.awk $(TDATA_TO_CHECK) + $(AWK) -f checklinks.awk -v backcheck=backward \ + $(TDATA_TO_CHECK) $(AWK) -f checklinks.awk tzdata.zi touch $@ diff --git a/NEWS b/NEWS index a898200..164ab95 100644 --- a/NEWS +++ b/NEWS @@ -3,9 +3,21 @@ News for the tz database Unreleased, experimental changes Briefly: + Move links to 'backward'. + In vanguard form, GMT is now a Zone and Etc/GMT a link. Simplify four Ontario zones into one. Fix a Y2438 bug when reading TZif data. + Changes to data + + Move links to 'backward' to ease and simplify link maintenance. + This affects generated data only if you use 'make BACKWARD='. + + GMT is now a Zone and Etc/GMT a link instead of vice versa, + as GMT is needed for leap second support whereas Etc/GMT is not. + However, this change exposes a bug in TZUpdater 2.3.2 so it is + present only in vanguard form for now. + Changes to past timestamps Simplify four Ontario zones to one, as the post-1970 differences diff --git a/asia b/asia index af1b822..c9bdc4d 100644 --- a/asia +++ b/asia @@ -1172,10 +1172,6 @@ Zone Asia/Famagusta 2:15:48 - LMT 1921 Nov 14 3:00 - +03 2017 Oct 29 1:00u 2:00 EUAsia EE%sT -# Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72. -# However, for various reasons many users expect to find it under Europe. -Link Asia/Nicosia Europe/Nicosia - # Georgia # From Paul Eggert (1994-11-19): # Today's _Economist_ (p 60) reports that Georgia moved its clocks forward diff --git a/backward b/backward index 3009da7..555e462 100644 --- a/backward +++ b/backward @@ -46,6 +46,8 @@ Link Asia/Shanghai Asia/Chongqing Link Asia/Shanghai Asia/Chungking Link Asia/Dhaka Asia/Dacca Link Asia/Shanghai Asia/Harbin +# Istanbul is in both continents. +Link Europe/Istanbul Asia/Istanbul Link Asia/Urumqi Asia/Kashgar Link Asia/Kathmandu Asia/Katmandu Link Asia/Macau Asia/Macao @@ -89,18 +91,42 @@ Link Pacific/Easter Chile/EasterIsland Link America/Havana Cuba Link Africa/Cairo Egypt Link Europe/Dublin Eire +# Vanguard section, for most .zi parsers. +#Link GMT Etc/GMT +#Link GMT Etc/GMT+0 +#Link GMT Etc/GMT-0 +#Link GMT Etc/GMT0 +#Link GMT Etc/Greenwich +# Rearguard section, for TZUpdater 2.3.2 and earlier. +Link Etc/GMT Etc/GMT+0 +Link Etc/GMT Etc/GMT-0 +Link Etc/GMT Etc/GMT0 +Link Etc/GMT Etc/Greenwich +# End of rearguard section. Link Etc/UTC Etc/UCT +Link Etc/UTC Etc/Universal +Link Etc/UTC Etc/Zulu Link Europe/London Europe/Belfast Link Europe/Kyiv Europe/Kiev +# Classically, Cyprus is in Asia; e.g. see Herodotus, Histories, I.72. +# However, for various reasons many users expect to find it under Europe. +Link Asia/Nicosia Europe/Nicosia Link Europe/Chisinau Europe/Tiraspol Link Europe/Kyiv Europe/Uzhgorod Link Europe/Kyiv Europe/Zaporozhye Link Europe/London GB Link Europe/London GB-Eire +# Vanguard section, for most .zi parsers. +#Link GMT GMT+0 +#Link GMT GMT-0 +#Link GMT GMT0 +#Link GMT Greenwich +# Rearguard section, for TZUpdater 2.3.2 and earlier. Link Etc/GMT GMT+0 Link Etc/GMT GMT-0 Link Etc/GMT GMT0 Link Etc/GMT Greenwich +# End of rearguard section. Link Asia/Hong_Kong Hongkong Link Africa/Abidjan Iceland Link Asia/Tehran Iran diff --git a/checklinks.awk b/checklinks.awk index f309010..45f67e3 100644 --- a/checklinks.awk +++ b/checklinks.awk @@ -7,6 +7,18 @@ BEGIN { # It is a newline so that it cannot match a valid name. # It is not null so that its slot does not appear unset. Zone = "\n" + + if (!zone_table) zone_table = "zone.tab" + + while (getline etcetera'. Also, the file 'backward' defines the legacy names +'Etc/GMT0', 'Etc/GMT-0', 'Etc/GMT+0', 'GMT0', 'GMT-0' and 'GMT+0', and the file 'northamerica' defines the legacy names 'EST5EDT', 'CST6CDT', diff --git a/zdump.c b/zdump.c index a63a343..ef6cb8b 100644 --- a/zdump.c +++ b/zdump.c @@ -281,9 +281,9 @@ gmtzinit(void) if (USE_LOCALTIME_RZ) { /* Try "GMT" first to find out whether this is one of the rare platforms where time_t counts leap seconds; this works due to - the "Link Etc/GMT GMT" line in the "etcetera" file. If "GMT" + the "Zone GMT 0 - GMT" line in the "etcetera" file. If "GMT" fails, fall back on "GMT0" which might be similar due to the - "Link Etc/GMT GMT0" line in the "backward" file, and which + "Link GMT GMT0" line in the "backward" file, and which should work on all POSIX platforms. The rest of zdump does not use the "GMT" abbreviation that comes from this setting, so it is OK to use "GMT" here rather than the more-modern "UTC" which diff --git a/ziguard.awk b/ziguard.awk index 0556cc4..a864f9f 100644 --- a/ziguard.awk +++ b/ziguard.awk @@ -15,6 +15,9 @@ # after main became rearguard and vanguard became main). # There is no need to convert rearguard to other forms. # +# When converting to vanguard form, the output can use the line +# "Zone GMT 0 - GMT" which TZUpdater 2.3.2 mistakenly rejects. +# # When converting to vanguard form, the output can use negative SAVE # values. # @@ -151,6 +154,17 @@ DATAFORM != "main" { } } + # In vanguard form, use the line "Zone GMT 0 - GMT" instead of + # "Zone Etc/GMT 0 - GMT" and adjust Link lines accordingly. + # This works around a bug in TZUpdater 2.3.2. + if (/^#?(Zone|Link)[\t ]+(Etc\/)?GMT[\t ]/) { + if (($2 == "GMT") == (DATAFORM == "vanguard")) { + uncomment = in_comment + } else { + comment_out = !in_comment + } + } + if (uncomment) { sub(/^#/, "") } -- 2.37.3