summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart.bishop@canonical.com>2020-04-28 17:27:48 +1000
committerStuart Bishop <stuart.bishop@canonical.com>2020-04-28 17:27:48 +1000
commitbc11842827a7379d99ff529674e1084a0a32a245 (patch)
tree8c7ccb9db42b8934387496a3decafaa28e079b88
parent5e47a3ec05c6dbc232fc867cec78ec4568f27c99 (diff)
downloadpytz-git-bc11842827a7379d99ff529674e1084a0a32a245.tar.gz
Squashed 'tz/' changes from 765984a93..13af01673
7aec41a1d Release 2020a d5f78a432 Clarify zdump -c c1755bba4 Deprecate tzsetwall 7eab71e7a * tz-link.html: Update URLs. 2455b0ac4 Define “UT” in man pages a8bf332a1 * backzone: Commentary from Phake Nick. 73e69e765 Shanghai observed DST in 1919 f9aacafa4 Morocco springs forward on 05-31, not 05-24. e960c41b5 Mention ziguard.awk in some tzdata comments. 6c9502af4 Israel decided not to change DST rules after all b7adcf175 Israel starts 2020 DST on 05-01, not 03-27 f5ca09068 Fix incorrect zdump warning for "AES)T5" c7cc14a84 Update URL for "Date & Time Formats on the Web" 33fd3277e Improve comments for Ukraine regions e6c1f0e7d Yukon advances to year-round -07 from 2020-03-08. 9a4b3dce5 * tz-art.html (Comics): Add xkcd 2266 (thanks to Guy Harris). 10f89078f Add comment about western Ontario zone extents a4db43137 Cite Frumer on pre-1873 Japan timekeeping 512fce07f Reorder Japan comments fb434180b Add support for Expires lines to zic b4cc8501c Simplify leapadd fd277c5ca Fix leap second bug after last explicit transition 04742d2e4 Fix leapseconds.awk portability bug b4b88c3b8 * leap-seconds.list: Omit stray space (fix from upstream). 2ae2ca6ca Improve comments for Quebec and Yukon. f6a9b02d6 No leap second on 2020-06-30 63fdca732 Remove "Xianggang" from asia comment fc4a4b005 * europe: Accent “Reykjavík”. 2c12bae19 * tz-art.html: Add "Does Anybody Really Know What Time It Is?" abb3d642e Support -DUSG_COMPAT=2 on FreeBSD 1a27ec76b Allow definition of vars the system lacks 6063ea746 * theory.html: Fix HAVE_TZNAME typo. 80acc494c * NEWS: Fix release typo in Nuuk change. cc6365997 * theory.html: Give Asia/Calcutta as an example. d7715ab77 Rename America/Godthab to America/Nuuk 06b51ae81 * tz-link.html (Costs and benefits of DST): New section. cad14a255 * northamerica: Update Garland URL. e733957e6 Commentary update for Palestine 035492ecf Rename asctime symbols if required in private.h 152bc8f7d Fix 1989 oversight in building libtz.a git-subtree-dir: tz git-subtree-split: 13af01673d5a82cf0eca7c8dcbe62685fa331440
-rw-r--r--Makefile38
-rw-r--r--NEWS82
-rw-r--r--africa54
-rw-r--r--asia212
-rw-r--r--backward1
-rw-r--r--backzone29
-rw-r--r--europe16
-rw-r--r--leap-seconds.list10
-rwxr-xr-xleapseconds.awk17
-rw-r--r--localtime.c55
-rw-r--r--northamerica48
-rw-r--r--private.h37
-rw-r--r--strftime.c4
-rw-r--r--theory.html23
-rw-r--r--tz-art.html12
-rw-r--r--tz-link.html51
-rw-r--r--tzfile.51
-rw-r--r--zdump.810
-rw-r--r--zdump.c6
-rw-r--r--zic.843
-rw-r--r--zic.c156
-rw-r--r--zone.tab12
-rw-r--r--zone1970.tab12
23 files changed, 672 insertions, 257 deletions
diff --git a/Makefile b/Makefile
index fec0a4f..610bf19 100644
--- a/Makefile
+++ b/Makefile
@@ -150,6 +150,15 @@ TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
REDO= posix_right
+# Whether to put an "Expires" line in the leapseconds file.
+# Use EXPIRES_LINE=1 to put the line in, 0 to omit it.
+# The EXPIRES_LINE value matters only if REDO's value contains "right".
+# If you change EXPIRES_LINE, remove the leapseconds file before running "make".
+# zic's support for the Expires line was introduced in tzdb 2020a,
+# and EXPIRES_LINE defaults to 0 for now so that the leapseconds file
+# can be given to older zic implementations.
+EXPIRES_LINE= 0
+
# To install data in text form that has all the information of the TZif data,
# (optionally incorporating leap second information), use
# TZDATA_TEXT= tzdata.zi leapseconds
@@ -295,8 +304,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# than TM_GMTOFF and TM_ZONE. However, most of them are standardized.
# #
# # To omit or support the external variable "tzname", add one of:
-# # -DHAVE_TZNAME=0
-# # -DHAVE_TZNAME=1
+# # -DHAVE_TZNAME=0 # do not support "tzname"
+# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library
+# # -DHAVE_TZNAME=2 # support and define "tzname"
# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later.
# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
@@ -304,16 +314,20 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# # presumably due to memory allocation issues.
# #
# # To omit or support the external variables "timezone" and "daylight", add
-# # -DUSG_COMPAT=0
-# # -DUSG_COMPAT=1
+# # -DUSG_COMPAT=0 # do not support
+# # -DUSG_COMPAT=1 # support, and variables are defined by system library
+# # -DUSG_COMPAT=2 # support and define variables
# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by
# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later.
# # If not defined, the code attempts to guess USG_COMPAT from other macros.
# #
# # To support the external variable "altzone", add
-# # -DALTZONE
+# # -DALTZONE=0 # do not support
+# # -DALTZONE=1 # support "altzone", which is defined by system library
+# # -DALTZONE=2 # support and define "altzone"
# # to the end of the "CFLAGS=" line; although "altzone" appeared in
# # System V Release 3.1 it has not been standardized.
+# # If not defined, the code attempts to guess ALTZONE from other macros.
#
# If you want functions that were inspired by early versions of X3J11's work,
# add
@@ -321,9 +335,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# to the end of the "CFLAGS=" line. This arranges for the functions
# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
# "posix2time", and "time2posix" to be added to the time conversion library.
-# "tzsetwall" is like "tzset" except that it arranges for local wall clock
-# time (rather than the timezone specified in the TZ environment variable)
-# to be used.
+# "tzsetwall" is deprecated and is intended to be removed soon; see NEWS.
# "offtime" is like "gmtime" except that it accepts a second (long) argument
# that gives an offset to add to the time_t when converting it.
# "timelocal" is equivalent to "mktime".
@@ -333,7 +345,6 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# that gives an offset to use when converting to a time_t.
# "posix2time" and "time2posix" are described in an included manual page.
# X3J11's work does not describe any of these functions.
-# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0.
# These functions may well disappear in future releases of the time
# conversion package.
#
@@ -505,11 +516,11 @@ RANLIB= :
TZCOBJS= zic.o
TZDOBJS= zdump.o localtime.o asctime.o strftime.o
DATEOBJS= date.o localtime.o strftime.o asctime.o
-LIBSRCS= localtime.c asctime.c difftime.c
-LIBOBJS= localtime.o asctime.o difftime.o
+LIBSRCS= localtime.c asctime.c difftime.c strftime.c
+LIBOBJS= localtime.o asctime.o difftime.o strftime.o
HEADERS= tzfile.h private.h
NONLIBSRCS= zic.c zdump.c
-NEWUCBSRCS= date.c strftime.c
+NEWUCBSRCS= date.c
SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \
tzselect.ksh workman.sh
MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \
@@ -651,7 +662,8 @@ yearistype: yearistype.sh
chmod +x yearistype
leapseconds: $(LEAP_DEPS)
- $(AWK) -f leapseconds.awk leap-seconds.list >$@.out
+ $(AWK) -v EXPIRES_LINE=$(EXPIRES_LINE) \
+ -f leapseconds.awk leap-seconds.list >$@.out
mv $@.out $@
# Arguments to pass to submakes of install_data.
diff --git a/NEWS b/NEWS
index af0f06f..321e090 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,87 @@
News for the tz database
+Release 2020a - 2020-04-23 16:03:47 -0700
+
+ Briefly:
+ Morocco springs forward on 2020-05-31, not 2020-05-24.
+ Canada's Yukon advanced to -07 year-round on 2020-03-08.
+ America/Nuuk renamed from America/Godthab.
+ zic now supports expiration dates for leap second lists.
+
+ Changes to future timestamps
+
+ Morocco's second spring-forward transition in 2020 will be May 31,
+ not May 24 as predicted earlier. (Thanks to Semlali Naoufal.)
+ Adjust future-year predictions to use the first Sunday after the
+ day after Ramadan, not the first Sunday after Ramadan.
+
+ Canada's Yukon, represented by America/Whitehorse and
+ America/Dawson, advanced to -07 year-round, beginning with its
+ spring-forward transition on 2020-03-08, and will not fall back on
+ 2020-11-01. Although a government press release calls this
+ "permanent Pacific Daylight Saving Time", we prefer MST for
+ consistency with nearby Dawson Creek, Creston, and Fort Nelson.
+ (Thanks to Tim Parenti.)
+
+ Changes to past timestamps
+
+ Shanghai observed DST in 1919. (Thanks to Phake Nick.)
+
+ Changes to timezone identifiers
+
+ To reflect current usage in English better, America/Godthab has
+ been renamed to America/Nuuk. A backwards-compatibility link
+ remains for the old name.
+
+ Changes to code
+
+ localtime.c no longer mishandles timestamps after the last
+ transition in a TZif file with leap seconds and with daylight
+ saving time transitions projected into the indefinite future.
+ For example, with TZ='America/Los_Angeles' with leap seconds,
+ zdump formerly reported a DST transition on 2038-03-14
+ from 01:59:32.999... to 02:59:33 instead of the correct transition
+ from 01:59:59.999... to 03:00:00.
+
+ zic -L now supports an Expires line in the leapseconds file, and
+ truncates the TZif output accordingly. This propagates leap
+ second expiration information into the TZif file, and avoids the
+ abovementioned localtime.c bug as well as similar bugs present in
+ many client implementations. If no Expires line is present, zic
+ -L instead truncates the TZif output based on the #expires comment
+ present in leapseconds files distributed by tzdb 2018f and later;
+ however, this usage is obsolescent. For now, the distributed
+ leapseconds file has an Expires line that is commented out, so
+ that the file can be fed to older versions of zic which ignore the
+ commented-out line. Future tzdb distributions are planned to
+ contain a leapseconds file with an Expires line.
+
+ The configuration macros HAVE_TZNAME and USG_COMPAT should now be
+ set to 1 if the system library supports the feature, and 2 if not.
+ As before, these macros are nonzero if tzcode should support the
+ feature, zero otherwise.
+
+ The configuration macro ALTZONE now has the same values with the
+ same meaning as HAVE_TZNAME and USG_COMPAT.
+
+ The code's defense against CRLF in leap-seconds.list is now
+ portable to POSIX awk. (Problem reported by Deborah Goldsmith.)
+
+ Although the undocumented tzsetwall function is not changed in
+ this release, it is now deprecated in preparation for removal in
+ future releases. Due to POSIX requirements, tzsetwall has not
+ worked for some time. Any code that uses it should instead use
+ tzalloc(NULL) or, if portability trumps thread-safety, should
+ unset the TZ environment variable.
+
+ Changes to commentary
+
+ The Îles-de-la-Madeleine and the Listuguj reserve are noted as
+ following America/Halifax, and comments about Yukon's "south" and
+ "north" have been corrected to say "east" and "west". (Thanks to
+ Jeffery Nichols.)
+
+
Release 2019c - 2019-09-11 08:59:48 -0700
Briefly:
diff --git a/africa b/africa
index feb6017..724744f 100644
--- a/africa
+++ b/africa
@@ -867,19 +867,25 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
# Morocco will be on GMT starting from Sunday, May 5th 2019 at 3am.
# The switch to GMT+1 will occur on Sunday, June 9th 2019 at 2am....
# http://fr.le360.ma/societe/voici-la-date-du-retour-a-lheure-legale-au-maroc-188222
-#
-# From Paul Eggert (2019-05-20):
-# This agrees with our 2018-11-01 guess that the Moroccan government
-# would continue the practice of falling back at 03:00 the last Sunday
-# before Ramadan, and of springing forward at 02:00 the first Sunday after
-# Ramadan, as this has been the practice since 2012. To implement this,
-# transition dates for 2019 through 2087 were determined by running the
-# following program under GNU Emacs 26.2.
-# (let ((islamic-year 1440))
+
+# From Semlali Naoufal (2020-04-14):
+# Following the announcement by the Moroccan government, the switch to
+# GMT time will take place on Sunday, April 19, 2020 from 3 a.m. and
+# the return to GMT+1 time will take place on Sunday, May 31, 2020 at 2 a.m....
+# https://maroc-diplomatique.net/maroc-le-retour-a-lheure-gmt-est-prevu-dimanche-prochain/
+# http://aujourdhui.ma/actualite/gmt1-retour-a-lheure-normale-dimanche-prochain-1
+#
+# From Paul Eggert (2020-04-14):
+# For now, guess that in the future Morocco will fall back at 03:00
+# the last Sunday before Ramadan, and spring forward at 02:00 the
+# first Sunday after the day after Ramadan. To implement this,
+# transition dates for 2021 through 2087 were determined by running
+# the following program under GNU Emacs 26.3.
+# (let ((islamic-year 1442))
# (require 'cal-islam)
# (while (< islamic-year 1511)
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
-# (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
+# (b (1+ (calendar-islamic-to-absolute (list 10 1 islamic-year))))
# (sunday 0))
# (while (/= sunday (mod (setq a (1- a)) 7)))
# (while (/= sunday (mod b 7))
@@ -939,7 +945,7 @@ Rule Morocco 2018 only - Jun 17 2:00 1:00 -
Rule Morocco 2019 only - May 5 3:00 -1:00 -
Rule Morocco 2019 only - Jun 9 2:00 0 -
Rule Morocco 2020 only - Apr 19 3:00 -1:00 -
-Rule Morocco 2020 only - May 24 2:00 0 -
+Rule Morocco 2020 only - May 31 2:00 0 -
Rule Morocco 2021 only - Apr 11 3:00 -1:00 -
Rule Morocco 2021 only - May 16 2:00 0 -
Rule Morocco 2022 only - Mar 27 3:00 -1:00 -
@@ -955,7 +961,7 @@ Rule Morocco 2026 only - Mar 22 2:00 0 -
Rule Morocco 2027 only - Feb 7 3:00 -1:00 -
Rule Morocco 2027 only - Mar 14 2:00 0 -
Rule Morocco 2028 only - Jan 23 3:00 -1:00 -
-Rule Morocco 2028 only - Feb 27 2:00 0 -
+Rule Morocco 2028 only - Mar 5 2:00 0 -
Rule Morocco 2029 only - Jan 14 3:00 -1:00 -
Rule Morocco 2029 only - Feb 18 2:00 0 -
Rule Morocco 2029 only - Dec 30 3:00 -1:00 -
@@ -971,7 +977,7 @@ Rule Morocco 2033 only - Dec 25 2:00 0 -
Rule Morocco 2034 only - Nov 5 3:00 -1:00 -
Rule Morocco 2034 only - Dec 17 2:00 0 -
Rule Morocco 2035 only - Oct 28 3:00 -1:00 -
-Rule Morocco 2035 only - Dec 2 2:00 0 -
+Rule Morocco 2035 only - Dec 9 2:00 0 -
Rule Morocco 2036 only - Oct 19 3:00 -1:00 -
Rule Morocco 2036 only - Nov 23 2:00 0 -
Rule Morocco 2037 only - Oct 4 3:00 -1:00 -
@@ -987,7 +993,7 @@ Rule Morocco 2041 only - Sep 29 2:00 0 -
Rule Morocco 2042 only - Aug 10 3:00 -1:00 -
Rule Morocco 2042 only - Sep 21 2:00 0 -
Rule Morocco 2043 only - Aug 2 3:00 -1:00 -
-Rule Morocco 2043 only - Sep 6 2:00 0 -
+Rule Morocco 2043 only - Sep 13 2:00 0 -
Rule Morocco 2044 only - Jul 24 3:00 -1:00 -
Rule Morocco 2044 only - Aug 28 2:00 0 -
Rule Morocco 2045 only - Jul 9 3:00 -1:00 -
@@ -1003,7 +1009,7 @@ Rule Morocco 2049 only - Jul 4 2:00 0 -
Rule Morocco 2050 only - May 15 3:00 -1:00 -
Rule Morocco 2050 only - Jun 26 2:00 0 -
Rule Morocco 2051 only - May 7 3:00 -1:00 -
-Rule Morocco 2051 only - Jun 11 2:00 0 -
+Rule Morocco 2051 only - Jun 18 2:00 0 -
Rule Morocco 2052 only - Apr 28 3:00 -1:00 -
Rule Morocco 2052 only - Jun 2 2:00 0 -
Rule Morocco 2053 only - Apr 13 3:00 -1:00 -
@@ -1019,7 +1025,7 @@ Rule Morocco 2057 only - Apr 8 2:00 0 -
Rule Morocco 2058 only - Feb 17 3:00 -1:00 -
Rule Morocco 2058 only - Mar 31 2:00 0 -
Rule Morocco 2059 only - Feb 9 3:00 -1:00 -
-Rule Morocco 2059 only - Mar 16 2:00 0 -
+Rule Morocco 2059 only - Mar 23 2:00 0 -
Rule Morocco 2060 only - Feb 1 3:00 -1:00 -
Rule Morocco 2060 only - Mar 7 2:00 0 -
Rule Morocco 2061 only - Jan 16 3:00 -1:00 -
@@ -1029,13 +1035,13 @@ Rule Morocco 2062 only - Feb 12 2:00 0 -
Rule Morocco 2062 only - Dec 31 3:00 -1:00 -
Rule Morocco 2063 only - Feb 4 2:00 0 -
Rule Morocco 2063 only - Dec 16 3:00 -1:00 -
-Rule Morocco 2064 only - Jan 20 2:00 0 -
+Rule Morocco 2064 only - Jan 27 2:00 0 -
Rule Morocco 2064 only - Dec 7 3:00 -1:00 -
Rule Morocco 2065 only - Jan 11 2:00 0 -
Rule Morocco 2065 only - Nov 22 3:00 -1:00 -
Rule Morocco 2066 only - Jan 3 2:00 0 -
Rule Morocco 2066 only - Nov 14 3:00 -1:00 -
-Rule Morocco 2066 only - Dec 19 2:00 0 -
+Rule Morocco 2066 only - Dec 26 2:00 0 -
Rule Morocco 2067 only - Nov 6 3:00 -1:00 -
Rule Morocco 2067 only - Dec 11 2:00 0 -
Rule Morocco 2068 only - Oct 21 3:00 -1:00 -
@@ -1045,13 +1051,13 @@ Rule Morocco 2069 only - Nov 17 2:00 0 -
Rule Morocco 2070 only - Oct 5 3:00 -1:00 -
Rule Morocco 2070 only - Nov 9 2:00 0 -
Rule Morocco 2071 only - Sep 20 3:00 -1:00 -
-Rule Morocco 2071 only - Oct 25 2:00 0 -
+Rule Morocco 2071 only - Nov 1 2:00 0 -
Rule Morocco 2072 only - Sep 11 3:00 -1:00 -
Rule Morocco 2072 only - Oct 16 2:00 0 -
Rule Morocco 2073 only - Aug 27 3:00 -1:00 -
Rule Morocco 2073 only - Oct 8 2:00 0 -
Rule Morocco 2074 only - Aug 19 3:00 -1:00 -
-Rule Morocco 2074 only - Sep 23 2:00 0 -
+Rule Morocco 2074 only - Sep 30 2:00 0 -
Rule Morocco 2075 only - Aug 11 3:00 -1:00 -
Rule Morocco 2075 only - Sep 15 2:00 0 -
Rule Morocco 2076 only - Jul 26 3:00 -1:00 -
@@ -1061,7 +1067,7 @@ Rule Morocco 2077 only - Aug 22 2:00 0 -
Rule Morocco 2078 only - Jul 10 3:00 -1:00 -
Rule Morocco 2078 only - Aug 14 2:00 0 -
Rule Morocco 2079 only - Jun 25 3:00 -1:00 -
-Rule Morocco 2079 only - Jul 30 2:00 0 -
+Rule Morocco 2079 only - Aug 6 2:00 0 -
Rule Morocco 2080 only - Jun 16 3:00 -1:00 -
Rule Morocco 2080 only - Jul 21 2:00 0 -
Rule Morocco 2081 only - Jun 1 3:00 -1:00 -
@@ -1077,7 +1083,7 @@ Rule Morocco 2085 only - May 27 2:00 0 -
Rule Morocco 2086 only - Apr 14 3:00 -1:00 -
Rule Morocco 2086 only - May 19 2:00 0 -
Rule Morocco 2087 only - Mar 30 3:00 -1:00 -
-Rule Morocco 2087 only - May 4 2:00 0 -
+Rule Morocco 2087 only - May 11 2:00 0 -
# For dates after the somewhat-arbitrary cutoff of 2087, assume that
# Morocco will no longer observe DST. At some point this table will
# need to be extended, though quite possibly Morocco will change the
@@ -1179,7 +1185,7 @@ Link Africa/Maputo Africa/Lusaka # Zambia
Rule Namibia 1994 only - Mar 21 0:00 -1:00 WAT
Rule Namibia 1994 2017 - Sep Sun>=1 2:00 0 CAT
Rule Namibia 1995 2017 - Apr Sun>=1 2:00 -1:00 WAT
-# Rearguard section, for parsers that do not support negative DST.
+# Rearguard section, for parsers lacking negative DST; see ziguard.awk.
#Rule Namibia 1994 only - Mar 21 0:00 0 WAT
#Rule Namibia 1994 2017 - Sep Sun>=1 2:00 1:00 CAT
#Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 WAT
@@ -1193,7 +1199,7 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8
2:00 - SAST 1990 Mar 21 # independence
# Vanguard section, for zic and other parsers that support negative DST.
2:00 Namibia %s
-# Rearguard section, for parsers that do not support negative DST.
+# Rearguard section, for parsers lacking negative DST; see ziguard.awk.
# 2:00 - CAT 1994 Mar 21 0:00
# From Paul Eggert (2017-04-07):
# The official date of the 2017 rule change was 2017-10-24. See:
diff --git a/asia b/asia
index b29c896..106efad 100644
--- a/asia
+++ b/asia
@@ -286,6 +286,27 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon
# China
+# From Phake Nick (2020-04-15):
+# According to this news report:
+# http://news.sina.com.cn/c/2004-09-01/19524201403.shtml
+# on April 11, 1919, newspaper in Shanghai said clocks in Shanghai will spring
+# forward for an hour starting from midnight of that Saturday. The report did
+# not mention what happened in Shanghai thereafter, but it mentioned that a
+# similar trial in Tianjin which ended at October 1st as citizens are told to
+# recede the clock on September 30 from 12:00pm to 11:00pm. The trial at
+# Tianjin got terminated in 1920.
+#
+# From Paul Eggert (2020-04-15):
+# The Returns of Trade and Trade Reports, page 711, says "Daylight saving was
+# given a trial during the year, and from the 12th April to the 1st October
+# the clocks were all set one hour ahead of sun time. Though the scheme was
+# generally esteemed a success, it was announced early in 1920 that it would
+# not be repeated."
+#
+# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
+Rule Shang 1919 only - Apr 12 24:00 1:00 D
+Rule Shang 1919 only - Sep 30 24:00 0 S
+
# From Paul Eggert (2018-10-02):
# The following comes from Table 1 of:
# Li Yu. Research on the daylight saving movement in 1940s Shanghai.
@@ -294,6 +315,89 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon
# The table lists dates only; I am guessing 00:00 and 24:00 transition times.
# Also, the table lists the planned end of DST in 1949, but the corresponding
# zone line cuts this off on May 28, when the Communists took power.
+
+# From Phake Nick (2020-04-15):
+#
+# For the history of time in Shanghai between 1940-1942, the situation is
+# actually slightly more complex than the table [below].... At the time,
+# there were three different authorities in Shanghai, including Shanghai
+# International Settlement, a settlement established by western countries with
+# its own westernized form of government, Shanghai French Concession, similar
+# to the international settlement but is controlled by French, and then the
+# rest of the city of Shanghai, which have already been controlled by Japanese
+# force through a puppet local government (Wang Jingwei regime). It was
+# additionally complicated by the circumstances that, according to the 1940s
+# Shanghai summer time essay cited in the database, some
+# departments/businesses/people in the Shanghai city itself during that time
+# period, refused to change their clock and instead only changed their opening
+# hours.
+#
+# For example, as quoted in the article, in 1940, other than the authority
+# itself, power, tram, bus companies, cinema, department stores, and other
+# public service organizations have all decided to follow the summer time and
+# spring forward the clock. On the other hand, the custom office refused to
+# spring forward the clock because of worry on mechanical wear to the physical
+# clock, postal office refused to spring forward because of disruption to
+# business and log-keeping, although they did changed their office hour to
+# match rest of the city. So is travel agents, and also weather
+# observatory. It is said both time standards had their own supporters in the
+# city at the time, those who prefer new time standard would have moved their
+# clock while those who prefer the old time standard would keep their clock
+# unchange, and there were different clocks that use different time standard
+# in the city at the time for people who use different time standard to adjust
+# their clock to their preferred time.
+#
+# a. For the 1940 May 31 spring forward, the essay claim that it was
+# coordinared between the international settlement authority and the French
+# concession authority and have gathered support from Hong Kong and Xiamen,
+# that it would spring forward an hour from May 31 "midnight", and the essay
+# claim "Hong Kong government implemented the spring forward in the same time
+# on the same date as Shanghai".
+#
+# b. For the 1940 fall back, it was said that they initially intended to do
+# so on September 30 00:59 at night, however they postponed it to October 12
+# after discussion with relevant parties. However schools restored to the
+# original schedule ten days earlier.
+#
+# c. For the 1941 spring forward, it is said to start from March 15
+# "following the previous year's method", and in addition to that the essay
+# cited an announcement in 1941 from the Wang regime which said the Special
+# City of Shanghai under Wang regime control will follow the DST rule set by
+# the Settlements, irrespective of the original DST plan announced by the Wang
+# regime for other area under its control(April 1 to September 30). (no idea
+# to situation before that announcement)
+#
+# d. For the 1941 fall back, it was said that the fall back would occurs at
+# the end of September (A newspaper headline cited by the essay, published on
+# October 1, 1941, have the headlines which said "French Concession would
+# rewind to the old clock this morning), but it ultimately didn't happen due
+# to disagreement between the international settlement authority and the
+# French concession authority, and the fall back ultimately occurred on
+# November 1.
+#
+# e. In 1941 December, Japan have officially started war with the United
+# States and the United Kingdom, and in Shanghai they have marched into the
+# international settlement, taken over its control
+#
+# f. For the 1942 spring forward, the essay said that the spring forward
+# started on January 31. It said this time the custom office and postal
+# department will also change their clocks, unlike before.
+#
+# g. The essay itself didn't cover any specific changes thereafter until the
+# end of the war, it quoted a November 1942 command from the government of the
+# Wang regime, which claim the daylight saving time applies year round during
+# the war. However, the essay ambiguously said the period is "February 1 to
+# September 30", which I don't really understand what is the meaning of such
+# period in the context of year round implementation here.. More researches
+# might be needed to show exactly what happened during that period of time.
+
+# From Phake Nick (2020-04-15):
+# According to a Japanese tour bus pamphlet in Nanjing area believed to be
+# from around year 1941: http://www.tt-museum.jp/tairiku_0280_nan1941.html ,
+# the schedule listed was in the format of Japanese time. Which indicate some
+# use of the Japanese time (instead of syncing by DST) might have occurred in
+# the Yangtze river delta area during that period of time although the scope
+# of such use will need to be investigated to determine.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Shang 1940 only - Jun 1 0:00 1:00 D
@@ -572,7 +676,7 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928
6:00 - +06
-# Hong Kong (Xianggang)
+# Hong Kong
# Milne gives 7:36:41.7; round this.
@@ -582,9 +686,7 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928
# it is not [an] observatory, but the official meteorological agency of HK,
# and also serves as the official timing agency), there are some missing
# and incorrect rules. Although the exact switch over time is missing, I
-# think 3:30 is correct. The official DST record for Hong Kong can be
-# obtained from
-# http://www.hko.gov.hk/gts/time/Summertime.htm
+# think 3:30 is correct.
# From Phake Nick (2018-10-27):
# According to Singaporean newspaper
@@ -695,10 +797,10 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928
# Resolution of the Legislative Council passed on 9 May 1979
# https://www.legco.gov.hk/yr78-79/english/lc_sitg/hansard/h790509.pdf#page=39
-# From Paul Eggert (2019-05-31):
+# From Paul Eggert (2020-04-15):
# Here are the dates given at
-# https://www.hko.gov.hk/gts/time/Summertime.htm
-# as of 2014-06-19:
+# https://www.hko.gov.hk/en/gts/time/Summertime.htm
+# as of 2020-02-10:
# Year Period
# 1941 15 Jun to 30 Sep
# 1942 Whole year
@@ -1828,6 +1930,47 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880
# '9:00' and 'JST' is from Guy Harris.
+# From Paul Eggert (2020-01-19):
+# Starting in the 7th century, Japan generally followed an ancient Chinese
+# timekeeping system that divided night and day into six hours each,
+# with hour length depending on season. In 1873 the government
+# started requiring the use of a Western style 24-hour clock. See:
+# Yulia Frumer, "Making Time: Astronomical Time Measurement in Tokugawa Japan"
+# <https://www.worldcat.org/oclc/1043907065>. As the tzdb code and
+# data support only 24-hour clocks, its tables model timestamps before
+# 1873 using Western-style local mean time.
+
+# From Hideyuki Suzuki (1998-11-09):
+# 'Tokyo' usually stands for the former location of Tokyo Astronomical
+# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N.
+# This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996'
+# edited by National Astronomical Observatory of Japan....
+# JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST).
+# The law is enacted on 1886-07-07.
+
+# From Hideyuki Suzuki (1998-11-16):
+# The ordinance No. 51 (1886) established "standard time" in Japan,
+# which stands for the time on 135° E.
+# In the ordinance No. 167 (1895), "standard time" was renamed to "central
+# standard time". And the same ordinance also established "western standard
+# time", which stands for the time on 120° E.... But "western standard
+# time" was abolished in the ordinance No. 529 (1937). In the ordinance No.
+# 167, there is no mention regarding for what place western standard time is
+# standard....
+#
+# I wrote "ordinance" above, but I don't know how to translate.
+# In Japanese it's "chokurei", which means ordinance from emperor.
+
+# From Yu-Cheng Chuang (2013-07-12):
+# ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause
+# about standard time" ... The adoption began from Jan 1, 1896.
+# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
+#
+# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
+# means the whole Japan territory, including later occupations, adopt Japan
+# Central Time (UT+9). The adoption began on Oct 1, 1937.
+# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
+
# From Paul Eggert (1995-03-06):
# Today's _Asahi Evening News_ (page 4) reports that Japan had
# daylight saving between 1948 and 1951, but "the system was discontinued
@@ -1876,37 +2019,6 @@ Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S
Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D
Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D
-# From Hideyuki Suzuki (1998-11-09):
-# 'Tokyo' usually stands for the former location of Tokyo Astronomical
-# Observatory: 139° 44' 40.90" E (9h 18m 58.727s), 35° 39' 16.0" N.
-# This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996'
-# edited by National Astronomical Observatory of Japan....
-# JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST).
-# The law is enacted on 1886-07-07.
-
-# From Hideyuki Suzuki (1998-11-16):
-# The ordinance No. 51 (1886) established "standard time" in Japan,
-# which stands for the time on 135° E.
-# In the ordinance No. 167 (1895), "standard time" was renamed to "central
-# standard time". And the same ordinance also established "western standard
-# time", which stands for the time on 120° E.... But "western standard
-# time" was abolished in the ordinance No. 529 (1937). In the ordinance No.
-# 167, there is no mention regarding for what place western standard time is
-# standard....
-#
-# I wrote "ordinance" above, but I don't know how to translate.
-# In Japanese it's "chokurei", which means ordinance from emperor.
-
-# From Yu-Cheng Chuang (2013-07-12):
-# ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause
-# about standard time" ... The adoption began from Jan 1, 1896.
-# https://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
-#
-# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
-# means the whole Japan territory, including later occupations, adopt Japan
-# Central Time (UT+9). The adoption began on Oct 1, 1937.
-# https://ja.wikisource.org/wiki/明治二十八年勅令第百六十七號標準時ニ關スル件中改正ノ件
-
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Asia/Tokyo 9:18:59 - LMT 1887 Dec 31 15:00u
9:00 Japan J%sT
@@ -3086,22 +3198,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# [T]he Palestinian cabinet decision (Mar 8th 2016) published on
# http://www.palestinecabinet.gov.ps/WebSite/Upload/Decree/GOV_17/16032016134830.pdf
# states that summer time will end on Oct 29th at 01:00.
-#
-# From Tim Parenti (2016-10-19):
-# Predict fall transitions on October's last Saturday at 01:00 from now on.
-# This is consistent with the 2016 transition as well as our spring
-# predictions.
-#
-# From Paul Eggert (2016-10-19):
-# It's also consistent with predictions in the following URLs today:
-# https://www.timeanddate.com/time/change/gaza-strip/gaza
-# https://www.timeanddate.com/time/change/west-bank/hebron
# From Sharef Mustafa (2018-03-16):
-# Palestine summer time will start on Mar 24th 2018 by advancing the
-# clock by 60 minutes as per Palestinian cabinet decision published on
-# the official website, though the decree did not specify the exact
-# time of the time shift.
+# Palestine summer time will start on Mar 24th 2018 ...
# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817
# From Even Scharning (2019-03-23):
@@ -3111,15 +3210,20 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# From Sharif Mustafa (2019-03-26):
# The Palestinian cabinet announced today that the switch to DST will
# be on Fri Mar 29th 2019 by advancing the clock by 60 minutes.
-# The decree signing date is Mar 12th but it was not published till today.
-# The decree does not specify the exact time of switch.
# http://palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e54e9ea1-50ee-4137-84df-0d6c78da259b
#
# From Even Scharning (2019-04-10):
# Our source in Palestine said it happened Friday 29 at 00:00 local time....
+
+# From Sharef Mustafa (2019-10-18):
+# Palestine summer time will end on midnight Oct 26th 2019 ...
+# http://www.palestinecabinet.gov.ps/website/ar/ViewDetails?ID=43948
#
# From Paul Eggert (2019-04-10):
# For now, guess spring-ahead transitions are March's last Friday at 00:00.
+#
+# From Tim Parenti (2016-10-19):
+# Predict fall transitions on October's last Saturday at 01:00 from now on.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
diff --git a/backward b/backward
index b4ae3cf..e13ae52 100644
--- a/backward
+++ b/backward
@@ -17,6 +17,7 @@ Link America/Atikokan America/Coral_Harbour
Link America/Argentina/Cordoba America/Cordoba
Link America/Tijuana America/Ensenada
Link America/Indiana/Indianapolis America/Fort_Wayne
+Link America/Nuuk America/Godthab
Link America/Indiana/Indianapolis America/Indianapolis
Link America/Argentina/Jujuy America/Jujuy
Link America/Indiana/Knox America/Knox_IN
diff --git a/backzone b/backzone
index 3ccadd1..91fa21d 100644
--- a/backzone
+++ b/backzone
@@ -33,6 +33,35 @@
# assumes rules from other files. In the tz distribution, use
# 'make PACKRATDATA=backzone zones' to compile and install this file.
+
+# From Paul Eggert (2020-04-15):
+# The following remarks should be incorporated into this table sometime.
+# Patches in 'git format-patch' format would be welcome.
+#
+# From Phake Nick (2020-04-15):
+# ... the historical timezone data for those China zones seems to be
+# incorrect. The transition to GMT+8 date given there for these zones
+# were 1980 which also contradict the file description that they do
+# not disagree with normal zone after 1970. According to sources that
+# have also been cited in the asia file, except Xinjiang and Tibet,
+# they should have adopted the Beijing Time from around 1949/1950
+# depends on exactly when each of those cities were taken over by the
+# communist army. And they should also follow the DST setting of
+# Asia/Shanghai after that point of time. In addition,
+# http://gaz.ncl.edu.tw/detail.jsp?sysid=E1091792 the document from
+# Chongqing Nationalist government say in year 1945 all of China
+# should adopt summer time due to the war (not sure whether it
+# continued after WWII ends)(Probably only enforced in area under
+# their rule at the time?) The Asia/Harbin's 1932 and 1940 entry
+# should also be incorrect. As per sources recorded at
+# https://wiki.suikawiki.org/n/%E6%BA%80%E5%B7%9E%E5%9B%BD%E3%81%AE%E6%A8%99%E6%BA%96%E6%99%82
+# , in 1932 Harbin should have adopted UTC+8:00 instead of data
+# currently listed in the tz database according to official
+# announcement from Manchuko. And they should have adopted GMT+9 in
+# 1937 January 1st according to official announcement at the time
+# being cited on the webpage.
+
+
# Zones are sorted by zone name. Each zone is preceded by the
# name of the country that the zone is in, along with any other
# commentary and rules associated with the entry.
diff --git a/europe b/europe
index 361b396..5593c60 100644
--- a/europe
+++ b/europe
@@ -549,12 +549,13 @@ Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2
0:00 1:00 IST 1947 Nov 2 2:00s
0:00 - GMT 1948 Apr 18 2:00s
0:00 GB-Eire GMT/IST 1968 Oct 27
-# The next line is for when negative SAVE values are used.
+# Vanguard section, for zic and other parsers that support negative DST.
1:00 Eire IST/GMT
-# These three lines are for when SAVE values are always nonnegative.
+# Rearguard section, for parsers lacking negative DST; see ziguard.awk.
# 1:00 - IST 1971 Oct 31 2:00u
# 0:00 GB-Eire GMT/IST 1996
# 0:00 EU GMT/IST
+# End of rearguard section.
###############################################################################
@@ -1018,7 +1019,7 @@ Zone Europe/Prague 0:57:44 - LMT 1850
1:00 Czech CE%sT 1946 Dec 1 3:00
# Vanguard section, for zic and other parsers that support negative DST.
1:00 -1:00 GMT 1947 Feb 23 2:00
-# Rearguard section, for parsers that do not support negative DST.
+# Rearguard section, for parsers lacking negative DST; see ziguard.awk.
# 0:00 - GMT 1947 Feb 23 2:00
# End of rearguard section.
1:00 Czech CE%sT 1979
@@ -1175,14 +1176,17 @@ Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28
-3:00 - -03 1980 Apr 6 2:00
-3:00 EU -03/-02 1996
0:00 - GMT
+#
+# Use the old name Scoresbysund, as the current name Ittoqqortoormiit
+# exceeds tzdb's 14-letter limit and has no common English abbreviation.
Zone America/Scoresbysund -1:27:52 - LMT 1916 Jul 28 # Ittoqqortoormiit
-2:00 - -02 1980 Apr 6 2:00
-2:00 C-Eur -02/-01 1981 Mar 29
-1:00 EU -01/+00
-Zone America/Godthab -3:26:56 - LMT 1916 Jul 28 # Nuuk
+Zone America/Nuuk -3:26:56 - LMT 1916 Jul 28 # Godthåb
-3:00 - -03 1980 Apr 6 2:00
-3:00 EU -03/-02
-Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik air base
+Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik
-4:00 Thule A%sT
# Estonia
@@ -1552,7 +1556,7 @@ Zone Europe/Budapest 1:16:20 - LMT 1890 Oct
#
# From January 1st, 1908 the whole of Iceland was standardised at 1 hour
# behind GMT. Previously, local mean solar time was used in different parts
-# of Iceland, the almanak had been based on Reykjavik mean solar time which
+# of Iceland, the almanak had been based on Reykjavík mean solar time which
# was 1 hour and 28 minutes behind GMT.
#
# "first day of winter" referred to [below] means the first day of the 26 weeks
diff --git a/leap-seconds.list b/leap-seconds.list
index a1bc5a7..ac153da 100644
--- a/leap-seconds.list
+++ b/leap-seconds.list
@@ -62,7 +62,7 @@
# Terry Quinn, "The BIPM and the Accurate Measurement
# of Time," Proc. of the IEEE, Vol. 79, pp. 894-905,
# July, 1991. <http://dx.doi.org/10.1109/5.84965>
-# reprinted in:
+# reprinted in:
# Christine Hackman and Donald B Sullivan (eds.)
# Time and Frequency Measurement
# American Association of Physics Teachers (1996)
@@ -204,10 +204,10 @@
# current -- the update time stamp, the data and the name of the file
# will not change.
#
-# Updated through IERS Bulletin C58
-# File expires on: 28 June 2020
+# Updated through IERS Bulletin C59
+# File expires on: 28 December 2020
#
-#@ 3802291200
+#@ 3818102400
#
2272060800 10 # 1 Jan 1972
2287785600 11 # 1 Jul 1972
@@ -252,4 +252,4 @@
# the hash line is also ignored in the
# computation.
#
-#h f28827d2 f263b6c3 ec0f19eb a3e0dbf0 97f3fa30
+#h a1c168ae 27c79a7d 9dddcfc3 bcfe616b 2e2c44ea
diff --git a/leapseconds.awk b/leapseconds.awk
index 1fe5012..924ade9 100755
--- a/leapseconds.awk
+++ b/leapseconds.awk
@@ -68,12 +68,12 @@ BEGIN {
monthabbr[11] = "Nov"
monthabbr[12] = "Dec"
- # Strip trailing CR, in case the input has CRLF form a la NIST.
- RS = "\r?\n"
-
sstamp_init()
}
+# In case the input has CRLF form a la NIST.
+{ sub(/\r$/, "") }
+
/^#[ \t]*[Uu]pdated through/ || /^#[ \t]*[Ff]ile expires on/ {
last_lines = last_lines $0 "\n"
}
@@ -100,6 +100,17 @@ BEGIN {
}
END {
+ sstamp_to_ymdhMs(expires, ss_NTP)
+
+ print ""
+ print "# UTC timestamp when this leap second list expires."
+ print "# Any additional leap seconds will come after this."
+ print "# This Expires line is commented out for now,"
+ print "# so that pre-2020a zic implementations do not reject this file."
+ printf "%sExpires %.4d\t%s\t%.2d\t%.2d:%.2d:%.2d\n", \
+ EXPIRES_LINE ? "" : "#", \
+ ss_year, monthabbr[ss_month], ss_mday, ss_hour, ss_min, ss_sec
+
# The difference between the NTP and POSIX epochs is 70 years
# (including 17 leap days), each 24 hours of 60 minutes of 60
# seconds each.
diff --git a/localtime.c b/localtime.c
index 033e88f..6623eac 100644
--- a/localtime.c
+++ b/localtime.c
@@ -158,6 +158,7 @@ static struct tm *gmtsub(struct state const *, time_t const *, int_fast32_t,
struct tm *);
static bool increment_overflow(int *, int);
static bool increment_overflow_time(time_t *, int_fast32_t);
+static int_fast64_t leapcorr(struct state const *, time_t);
static bool normalize_overflow32(int_fast32_t *, int *, int);
static struct tm *timesub(time_t const *, int_fast32_t, struct state const *,
struct tm *);
@@ -193,20 +194,18 @@ static int lcl_is_set;
static struct tm tm;
-#if !HAVE_POSIX_DECLS || TZ_TIME_T
-# if HAVE_TZNAME
+#if 2 <= HAVE_TZNAME + TZ_TIME_T
char * tzname[2] = {
(char *) wildabbr,
(char *) wildabbr
};
-# endif
-# if USG_COMPAT
+#endif
+#if 2 <= USG_COMPAT + TZ_TIME_T
long timezone;
int daylight;
-# endif
-# ifdef ALTZONE
+#endif
+#if 2 <= ALTZONE + TZ_TIME_T
long altzone;
-# endif
#endif
/* Initialize *S to a value based on UTOFF, ISDST, and DESIGIDX. */
@@ -276,7 +275,7 @@ update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)
if (!ttisp->tt_isdst)
timezone = - ttisp->tt_utoff;
#endif
-#ifdef ALTZONE
+#if ALTZONE
if (ttisp->tt_isdst)
altzone = - ttisp->tt_utoff;
#endif
@@ -295,9 +294,9 @@ settzname(void)
daylight = 0;
timezone = 0;
#endif
-#ifdef ALTZONE
+#if ALTZONE
altzone = 0;
-#endif /* defined ALTZONE */
+#endif
if (sp == NULL) {
return;
}
@@ -643,11 +642,13 @@ tzloadbody(char const *name, struct state *sp, bool doextend,
for (i = 0; i < ts->timecnt; i++)
if (sp->timecnt == 0
- || sp->ats[sp->timecnt - 1] < ts->ats[i])
+ || (sp->ats[sp->timecnt - 1]
+ < ts->ats[i] + leapcorr(sp, ts->ats[i])))
break;
while (i < ts->timecnt
&& sp->timecnt < TZ_MAX_TIMES) {
- sp->ats[sp->timecnt] = ts->ats[i];
+ sp->ats[sp->timecnt]
+ = ts->ats[i] + leapcorr(sp, ts->ats[i]);
sp->types[sp->timecnt] = (sp->typecnt
+ ts->types[i]);
sp->timecnt++;
@@ -2241,20 +2242,6 @@ timeoff(struct tm *tmp, long offset)
#endif /* defined STD_INSPIRED */
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1 (POSIX) says that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
static int_fast64_t
leapcorr(struct state const *sp, time_t t)
{
@@ -2270,6 +2257,20 @@ leapcorr(struct state const *sp, time_t t)
return 0;
}
+/*
+** XXX--is the below the right way to conditionalize??
+*/
+
+#ifdef STD_INSPIRED
+
+/*
+** IEEE Std 1003.1 (POSIX) says that 536457599
+** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
+** is not the case if we are accounting for leap seconds.
+** So, we provide the following conversion routines for use
+** when exchanging timestamps with POSIX conforming systems.
+*/
+
NETBSD_INSPIRED_EXTERN time_t
time2posix_z(struct state *sp, time_t t)
{
@@ -2345,7 +2346,7 @@ posix2time(time_t t)
# define daylight 0
# define timezone 0
# endif
-# ifndef ALTZONE
+# if !ALTZONE
# define altzone 0
# endif
diff --git a/northamerica b/northamerica
index 8771d96..febf05b 100644
--- a/northamerica
+++ b/northamerica
@@ -86,7 +86,7 @@
# For more about the first ten years of DST in the United States, see
# Robert Garland, Ten years of daylight saving from the Pittsburgh standpoint
# (Carnegie Library of Pittsburgh, 1927).
-# http://www.clpgh.org/exhibit/dst.html
+# https://web.archive.org/web/20160517155308/http://www.clpgh.org/exhibit/dst.html
#
# Shanks says that DST was called "War Time" in the US in 1918 and 1919.
# However, DST was imposed by the Standard Time Act of 1918, which
@@ -1470,7 +1470,8 @@ Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay
-4:00 Canada A%sT
-# west Labrador, Nova Scotia, Prince Edward I
+# west Labrador, Nova Scotia, Prince Edward I,
+# Îles-de-la-Madeleine, Listuguj reserve
# From Brian Inglis (2015-07-20):
# From the historical weather station records available at:
@@ -1489,6 +1490,13 @@ Zone America/Goose_Bay -4:01:40 - LMT 1884 # Happy Valley-Goose Bay
# in Canada to observe DST in 1971 but not 1970; for now we'll assume
# this is a typo.
+# From Jeffery Nichols (2020-01-09):
+# America/Halifax ... also applies to Îles-de-la-Madeleine and the Listuguj
+# reserve in Quebec. Officially, this came into effect on January 1, 2007
+# (Legal Time Act, CQLR c T-5.1), but the legislative debates surrounding that
+# bill say that it is "accommodating the customs and practices" of those
+# regions, which suggests that they have always been in-line with Halifax.
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Halifax 1916 only - Apr 1 0:00 1:00 D
Rule Halifax 1916 only - Oct 1 0:00 0 S
@@ -1582,19 +1590,20 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9
# Quebec
-# From Paul Eggert (2015-03-24):
+# From Paul Eggert (2020-01-10):
# See America/Toronto for most of Quebec, including Montreal.
+# See America/Halifax for the Îles de la Madeleine and the Listuguj reserve.
#
# Matthews and Vincent (1998) also write that Quebec east of the -63
# meridian is supposed to observe AST, but residents as far east as
# Natashquan use EST/EDT, and residents east of Natashquan use AST.
# The Quebec department of justice writes in
# "The situation in Minganie and Basse-Côte-Nord"
-# http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm
+# https://www.justice.gouv.qc.ca/en/department/ministre/functions-and-responsabilities/legal-time-in-quebec/the-situation-in-minganie-and-basse-cote-nord/
# that the coastal strip from just east of Natashquan to Blanc-Sablon
# observes Atlantic standard time all year round.
-# https://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
-# says this common practice was codified into law as of 2007.
+# This common practice was codified into law as of 2007; see Legal Time Act,
+# CQLR c T-5.1 <http://legisquebec.gouv.qc.ca/en/ShowDoc/cs/T-5.1>.
# For lack of better info, guess this practice began around 1970, contra to
# Shanks & Pottenger who have this region observing AST/ADT.
@@ -1613,6 +1622,15 @@ Zone America/Blanc-Sablon -3:48:28 - LMT 1884
# Nipigon (EST) and Rainy River (CST) are the largest that we know of.
# Far west Ontario is like Winnipeg; far east Quebec is like Halifax.
+# From Jeffery Nichols (2020-02-06):
+# According to the [Shanks] atlas, those western Ontario zones are huge,
+# covering most of Ontario northwest of Sault Ste Marie and Timmins.
+# The zones seem to include towns bigger than the ones they're named after,
+# like Dryden in America/Rainy_River and Wawa (and maybe Attawapiskat) in
+# America/Nipigon. I assume it's too much trouble to change the name of the
+# zone (like when you found out that America/Glace_Bay includes Sydney, Nova
+# Scotia)....
+
# From Mark Brader (2003-07-26):
# [According to the Toronto Star] Orillia, Ontario, adopted DST
# effective Saturday, 1912-06-22, 22:00; the article mentions that
@@ -2419,6 +2437,18 @@ Zone America/Creston -7:46:04 - LMT 1884
# obtained in November 2008 should be ignored...
# I apologize for reporting incorrect information in 2008.
+# From Tim Parenti (2020-03-05):
+# The government of Yukon announced [yesterday] the cessation of seasonal time
+# changes. "After clocks are pushed ahead one hour on March 8, the territory
+# will remain on [UTC-07]. ... [The government] found 93 per cent of
+# respondents wanted to end seasonal time changes and, of that group, 70 per
+# cent wanted 'permanent Pacific Daylight Saving Time.'"
+# https://www.cbc.ca/news/canada/north/yukon-end-daylight-saving-time-1.5486358
+#
+# Although the government press release prefers PDT, we prefer MST for
+# consistency with nearby Dawson Creek, Creston, and Fort Nelson.
+# https://yukon.ca/en/news/yukon-end-seasonal-time-change
+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NT_YK 1918 only - Apr 14 2:00 1:00 D
Rule NT_YK 1918 only - Oct 27 2:00 0 S
@@ -2473,11 +2503,13 @@ Zone America/Inuvik 0 - -00 1953 # Inuvik founded
Zone America/Whitehorse -9:00:12 - LMT 1900 Aug 20
-9:00 NT_YK Y%sT 1967 May 28 0:00
-8:00 NT_YK P%sT 1980
- -8:00 Canada P%sT
+ -8:00 Canada P%sT 2020 Mar 8 2:00
+ -7:00 - MST
Zone America/Dawson -9:17:40 - LMT 1900 Aug 20
-9:00 NT_YK Y%sT 1973 Oct 28 0:00
-8:00 NT_YK P%sT 1980
- -8:00 Canada P%sT
+ -8:00 Canada P%sT 2020 Mar 8 2:00
+ -7:00 - MST
###############################################################################
diff --git a/private.h b/private.h
index 1ead147..8513663 100644
--- a/private.h
+++ b/private.h
@@ -132,11 +132,16 @@
** Nested includes
*/
-/* Avoid clashes with NetBSD by renaming NetBSD's declarations. */
+/* Avoid clashes with NetBSD by renaming NetBSD's declarations.
+ If defining the 'timezone' variable, avoid a clash with FreeBSD's
+ 'timezone' function by renaming its declaration. */
#define localtime_rz sys_localtime_rz
#define mktime_z sys_mktime_z
#define posix2time_z sys_posix2time_z
#define time2posix_z sys_time2posix_z
+#if defined USG_COMPAT && USG_COMPAT == 2
+# define timezone sys_timezone
+#endif
#define timezone_t sys_timezone_t
#define tzalloc sys_tzalloc
#define tzfree sys_tzfree
@@ -145,6 +150,9 @@
#undef mktime_z
#undef posix2time_z
#undef time2posix_z
+#if defined USG_COMPAT && USG_COMPAT == 2
+# undef timezone
+#endif
#undef timezone_t
#undef tzalloc
#undef tzfree
@@ -198,6 +206,14 @@
# endif
#endif
+#ifndef ALTZONE
+# if defined __sun || defined _M_XENIX
+# define ALTZONE 1
+# else
+# define ALTZONE 0
+# endif
+#endif
+
#ifndef R_OK
#define R_OK 4
#endif /* !defined R_OK */
@@ -409,6 +425,10 @@ static time_t sys_time(time_t *x) { return time(x); }
typedef time_tz tz_time_t;
+# undef asctime
+# define asctime tz_asctime
+# undef asctime_r
+# define asctime_r tz_asctime_r
# undef ctime
# define ctime tz_ctime
# undef ctime_r
@@ -473,11 +493,13 @@ typedef time_tz tz_time_t;
# undef timezone
# define timezone tz_timezone
# endif
-# ifdef ALTZONE
+# if ALTZONE
# undef altzone
# define altzone tz_altzone
# endif
+char *asctime(struct tm const *);
+char *asctime_r(struct tm const *restrict, char *restrict);
char *ctime(time_t const *);
char *ctime_r(time_t const *, char *);
double difftime(time_t, time_t) ATTRIBUTE_CONST;
@@ -512,17 +534,14 @@ extern char *asctime_r(struct tm const *restrict, char *restrict);
extern char **environ;
#endif
-#if TZ_TIME_T || !HAVE_POSIX_DECLS
-# if HAVE_TZNAME
+#if 2 <= HAVE_TZNAME + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern char *tzname[];
-# endif
-# if USG_COMPAT
+#endif
+#if 2 <= USG_COMPAT + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern long timezone;
extern int daylight;
-# endif
#endif
-
-#ifdef ALTZONE
+#if 2 <= ALTZONE + (TZ_TIME_T || !HAVE_POSIX_DECLS)
extern long altzone;
#endif
diff --git a/strftime.c b/strftime.c
index ac26f4b..14cbc9a 100644
--- a/strftime.c
+++ b/strftime.c
@@ -492,7 +492,7 @@ label:
*/
continue;
case 'z':
-#if defined TM_GMTOFF || USG_COMPAT || defined ALTZONE
+#if defined TM_GMTOFF || USG_COMPAT || ALTZONE
{
long diff;
char const * sign;
@@ -529,7 +529,7 @@ label:
continue;
# endif
else
-# ifdef ALTZONE
+# if ALTZONE
diff = -altzone;
# else
continue;
diff --git a/theory.html b/theory.html
index 7af7cb2..c0e6f02 100644
--- a/theory.html
+++ b/theory.html
@@ -298,6 +298,10 @@ in decreasing order of importance:
If a name is changed, put its old spelling in the
'<code>backward</code>' file.
This means old spellings will continue to work.
+ Ordinarily a name change should occur only in the rare case when
+ a location's consensus English-language spelling changes; for example,
+ in 2008 <code>Asia/Calcutta</code> was renamed to <code>Asia/Kolkata</code>
+ due to long-time widespread use of the new city name instead of the old.
</li>
</ul>
@@ -1054,23 +1058,6 @@ an older <code>zic</code>.
The functions were inspired by <a href="https://netbsd.org/">NetBSD</a>.
</li>
<li>
- A function <code>tzsetwall</code> has been added to arrange for the
- system's best approximation to local (wall clock) time to be delivered
- by subsequent calls to <code>localtime</code>.
- Source code for portable applications that "must" run on local
- time should call <code>tzsetwall</code>;
- if such code is moved to "old" systems that do not
- provide <code>tzsetwall</code>, you will not be able to generate an
- executable program.
- (These functions also arrange for local time to
- be used if <code>tzset</code> is called &ndash; directly or
- indirectly &ndash; and there is no <code>TZ</code> environment
- variable; portable applications should not, however, rely on this
- behavior since it is not the way <a
- href="https://en.wikipedia.org/wiki/UNIX_System_V#SVR2"><abbr>SVR2</abbr></a>
- systems behave.)
- </li>
- <li>
Negative <code>time_t</code> values are supported, on systems
where <code>time_t</code> is signed.
</li>
@@ -1137,7 +1124,7 @@ The vestigial <abbr>API</abbr>s are:
may now examine <code>localtime(&amp;clock)-&gt;tm_zone</code>
(if <code>TM_ZONE</code> is defined) or
<code>tzname[localtime(&amp;clock)-&gt;tm_isdst]</code>
- (if <code>HAVE_TZNAME</code> is defined) to learn the correct time
+ (if <code>HAVE_TZNAME</code> is nonzero) to learn the correct time
zone abbreviation to use.
</li>
<li>
diff --git a/tz-art.html b/tz-art.html
index 8c57174..93a99e4 100644
--- a/tz-art.html
+++ b/tz-art.html
@@ -458,6 +458,15 @@ Supernaw.</td></tr>
<tr><td><a href="https://www.allmusic.com/album/youre-getting-better-the-word-jazz-dot-masters-mw0000736197">AMG Rating</a></td><td>4.5 stars</td></tr>
<tr><td>Notes</td><td>Includes the piece "What Time Is It"
("He knew what time it was everywhere...that counted").</td></tr>
+<tr><td>&nbsp;</td><td></td></tr>
+<tr><td>Artist</td><td>Chicago</td></tr>
+<tr><td>CD</td><td>Chicago Transit Authority</td></tr>
+<tr><td>Copyright Date</td><td>1969</td></tr>
+<tr><td>Label</td><td>Columbia</td></tr>
+<tr><td>ID</td><td>64409</td></tr>
+<tr><td>Total Time</td><td>1:16:20</td></tr>
+<tr><td><a href="https://www.allmusic.com/album/chicago-transit-authority-mw0000189364">AMG Rating</a></td><td>4 stars</td></tr>
+<tr><td>Notes</td><td>Includes the song "Does Anybody Really Know What Time It Is?"</td></tr>
</table>
<h2>Comics</h2>
<ul>
@@ -472,7 +481,8 @@ The webcomic <em>xkcd</em> has the strip
"<a href='https://xkcd.com/1799/'>Bad Map Projection: Time Zones</a>"
(2017-02-15),
"<a href='https://xkcd.com/1883/'>Supervillain Plan</a>" (2017-08-30),
-and "<a href='https://xkcd.com/2050/'>6/6 Time</a>" (2018-09-24).
+"<a href='https://xkcd.com/2050/'>6/6 Time</a>" (2018-09-24),
+and "<a href='https://xkcd.com/2266/'>Leap Smearing</a>" (2020-02-10).
The related book <em>What If?</em> has an entry
"<a href='https://what-if.xkcd.com/26/'>Leap Seconds</a>" (2012-12-31).
</li>
diff --git a/tz-link.html b/tz-link.html
index e34ea20..1f893f6 100644
--- a/tz-link.html
+++ b/tz-link.html
@@ -49,6 +49,7 @@ area.
<ul>
<li><a href="#civil">Civil time concepts and history</a></li>
<li><a href="#national">National histories of legal time</a></li>
+ <li><a href="#costs">Costs and benefits of time shifts</a></li>
<li><a href="#precision">Precision timekeeping</a></li>
<li><a href="#notation">Time notation</a></li>
<li><a href="#see-also">See also</a></li>
@@ -81,11 +82,12 @@ title="Berkeley Software Distribution">BSD</abbr></a>,
<a href="https://www.openbsd.org">Open<abbr>BSD</abbr></a>,
<a href="https://www.chromium.org/chromium-os">Chromium OS</a>,
<a href="https://cygwin.com">Cygwin</a>,
+<a href="https://mariadb.org">MariaDB</a>,
<a href="https://en.wikipedia.org/wiki/MINIX">MINIX</a>,
<a href="https://www.mysql.com">MySQL</a>,
<a href="https://en.wikipedia.org/wiki/WebOS"><abbr
title="Web Operating System">webOS</abbr></a>,
-<a href="https://ibm.com/aix"><abbr
+<a href="https://en.wikipedia.org/wiki/IBM_AIX"><abbr
title="Advanced Interactive eXecutive">AIX</abbr></a>,
<a href="https://en.wikipedia.org/wiki/BlackBerry_10">BlackBerry 10</a>,
<a href="https://www.apple.com/ios"><abbr
@@ -167,7 +169,8 @@ then <samp>za</samp> through <samp>zz</samp>, then <samp>zza</samp>
through <samp>zzz</samp>, and so on).
Since version 2016h, each release has contained a text file named
"<samp>version</samp>" whose first (and currently only) line is the version.
-The releases are also available in an
+Older releases are <a href="https://ftp.iana.org/tz/releases/">archived</a>,
+and are also available in an
<a href="ftp://ftp.iana.org/tz/releases/"><abbr
title="File Transfer Protocol">FTP</abbr> directory</a> via a
less-secure protocol.</p>
@@ -826,10 +829,10 @@ zones and daylight saving time</a>.</dd>
Chile's official time (in Spanish)</a>.</dd>
<dt>China</dt>
<dd>The Hong Kong Observatory maintains a
-<a href="https://www.hko.gov.hk/gts/time/Summertime.htm">history of
+<a href="https://www.hko.gov.hk/en/gts/time/Summertime.htm">history of
summer time in Hong Kong</a>,
and Macau's Meteorological and Geophysical Bureau maintains a <a
-href="http://www.smg.gov.mo/smg/geophysics/e_t_Summer%20Time.htm">similar
+href="https://www.smg.gov.mo/en/subpage/224/page/174">similar
history for Macau</a>.
Unfortunately the latter is incomplete and has errors.</dd>
<dt>Czech Republic</dt>
@@ -865,7 +868,7 @@ href="https://www.dia.govt.nz/Daylight-Saving-History">History of
Daylight Saving</a>.</dd>
<dt>Singapore</dt>
<dd><a id="Singapore"
-href="http://www.math.nus.edu.sg/~mathelmr/teaching/timezone.html">Why
+href="https://web.archive.org/web/20190822231045/http://www.math.nus.edu.sg/~mathelmr/teaching/timezone.html">Why
is Singapore in the "Wrong" Time Zone?</a> details the
history of legal time in Singapore and Malaysia.</dd>
<dt>United Kingdom</dt>
@@ -880,12 +883,46 @@ Time Zone Proceedings</a> lists changes to time zone boundaries.</dd>
<dt>Uruguay</dt>
<dd>The Oceanography, Hydrography, and Meteorology Service of the Uruguayan
Navy (SOHMA) publishes an annual <a
-href="http://www.armada.gub.uy/sohma/index.php/servicios/datos-astronomicos" hreflang="es">almanac
+href="http://sohma.armada.mil.uy/index.php/servicios/datos-astronomicos" hreflang="es">almanac
(in Spanish)</a>.</dd>
</dl>
</section>
<section>
+<h2 id="costs">Costs and benefits of time shifts</h2>
+<p>Various sources argue for and against daylight saving time and time
+zone shifts, and many scientific studies have been conducted. This
+section summarizes reviews of scientific literature in the area.</p>
+<ul>
+<li>Carey RN, Sarma KM.
+<a href="https://bmjopen.bmj.com/content/7/6/e014319.long">Impact of
+daylight saving time on road traffic collision risk: a systematic
+review</a>.
+<em>BMJ Open.</em> 2017;7(6):e014319. doi:<a href="https://doi.org/10.1136/bmjopen-2016-014319">10.1136/bmjopen-2016-014319</a>.
+This reviews research literature and concludes that the evidence
+neither supports nor refutes road safety benefits from
+shifts in time zones.</li>
+<li>Havranek T, Herman D, Irsova D.
+<a href="https://www.econstor.eu/handle/10419/174191">Does daylight
+saving save electricity? A meta-analysis</a>. <em>Energy J.</em>
+2018;39(2).
+doi:<a href="https://doi.org/10.5547/01956574.39.2.thav">10.5547/01956574.39.2.thav</a>.
+This analyzes research literature and concludes, "Electricity savings
+are larger for countries farther away from the equator, while
+subtropical regions consume more electricity because of DST."</li>
+<li>Roenneberg T, Winnebeck EC, Klerman EB.
+<a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6692659/">Daylight
+saving time and artificial time zones &ndash; a battle between
+biological and social times</a>. <em>Front Physiol.</em> 2019;10:944.
+doi:<a href="https://doi.org/10.3389/fphys.2019.00944">10.3389/fphys.2019.00944</a>.
+This reviews evidence about the health effects of DST and concludes,
+"In summary, the scientific literature strongly argues against the
+switching between DST and Standard Time and even more so against
+adopting DST permanently."</li>
+</ul>
+</section>
+
+<section>
<h2 id="precision">Precision timekeeping</h2>
<ul>
<li><a
@@ -1022,7 +1059,7 @@ specifies an <abbr>ISO</abbr> 8601
profile for use in new Internet
protocols.</li>
<li>
-<a href="https://www.hackcraft.net/web/datetime/">Date &amp; Time
+<a href="https://web.archive.org/web/20190130042457/https://www.hackcraft.net/web/datetime/">Date &amp; Time
Formats on the Web</a> surveys web- and Internet-oriented date and time
formats.</li>
<li>Alphabetic time zone abbreviations should not be used as unique
diff --git a/tzfile.5 b/tzfile.5
index cd4c483..3f13563 100644
--- a/tzfile.5
+++ b/tzfile.5
@@ -42,6 +42,7 @@ Six four-byte integer values, in the following order:
.TP
.I tzh_ttisutcnt
The number of UT/local indicators stored in the file.
+(UT is Universal Time.)
.TP
.I tzh_ttisstdcnt
The number of standard/wall indicators stored in the file.
diff --git a/zdump.8 b/zdump.8
index fb6b8df..98109ad 100644
--- a/zdump.8
+++ b/zdump.8
@@ -74,11 +74,11 @@ implementations with different time representations.
Cut off interval output at the given year(s).
Cutoff times are computed using the proleptic Gregorian calendar with year 0
and with Universal Time (UT) ignoring leap seconds.
-The lower bound is exclusive and the upper is inclusive; for example, a
-.I loyear
-of 1970 excludes a transition occurring at 1970-01-01 00:00:00 UTC but a
-.I hiyear
-of 1970 includes the transition.
+Cutoffs are at the start of each year, where the lower-bound
+timestamp is exclusive and the upper is inclusive; for example,
+.B "\*-c 1970,2070"
+selects transitions after 1970-01-01 00:00:00 UTC
+and on or before 2070-01-01 00:00:00 UTC.
The default cutoff is
.BR \*-500,2500 .
.TP
diff --git a/zdump.c b/zdump.c
index 0fc8ced..b532fe3 100644
--- a/zdump.c
+++ b/zdump.c
@@ -328,12 +328,12 @@ abbrok(const char *const abbrp, const char *const zone)
cp = abbrp;
while (is_alpha(*cp) || is_digit(*cp) || *cp == '-' || *cp == '+')
++cp;
- if (cp - abbrp < 3)
+ if (*cp)
+ wp = _("has characters other than ASCII alphanumerics, '-' or '+'");
+ else if (cp - abbrp < 3)
wp = _("has fewer than 3 characters");
else if (cp - abbrp > 6)
wp = _("has more than 6 characters");
- else if (*cp)
- wp = _("has characters other than ASCII alphanumerics, '-' or '+'");
else
return;
fflush(stdout);
diff --git a/zic.8 b/zic.8
index dc0220f..b57cd2b 100644
--- a/zic.8
+++ b/zic.8
@@ -108,7 +108,7 @@ and it should not be combined with
.B "\*-b slim"
if
.IR timezone 's
-transitions are at standard time or UT instead of local time.
+transitions are at standard time or Universal Time (UT) instead of local time.
.TP
.BR "\*-r " "[\fB@\fP\fIlo\fP][\fB/@\fP\fIhi\fP]"
Reduce the size of output files by limiting their applicability
@@ -606,7 +606,9 @@ However, the behavior is unspecified if multiple zone or link lines
define the same name, or if the source of one link line is the target
of another.
.PP
-Lines in the file that describes leap seconds have the following form:
+The file that describes leap seconds can have leap lines and an
+expiration line.
+Leap lines have the following form:
.nf
.ti +.5i
.ta \w'Leap\0\0'u +\w'YEAR\0\0'u +\w'MONTH\0\0'u +\w'DAY\0\0'u +\w'HH:MM:SS\0\0'u +\w'CORR\0\0'u
@@ -646,6 +648,43 @@ or
.q "Rolling"
if the leap second time given by the other fields should be interpreted as
local (wall clock) time.
+.PP
+The expiration line, if present, has the form:
+.nf
+.ti +.5i
+.ta \w'Expires\0\0'u +\w'YEAR\0\0'u +\w'MONTH\0\0'u +\w'DAY\0\0'u
+.sp
+Expires YEAR MONTH DAY HH:MM:SS
+.sp
+For example:
+.ti +.5i
+.sp
+Expires 2020 Dec 28 00:00:00
+.sp
+.fi
+The
+.BR YEAR ,
+.BR MONTH ,
+.BR DAY ,
+and
+.B HH:MM:SS
+fields give the expiration timestamp in UTC for the leap second table;
+.B zic
+outputs this expiration timestamp by truncating the end of the output
+file to the timestamp.
+If there is no expiration line,
+.B zic
+also accepts a comment
+.q "#expires \fIE\fP ...\&"
+where
+.I E
+is the expiration timestamp as a decimal integer count of seconds
+since the Epoch, not counting leap seconds.
+However, the
+.q "#expires"
+comment is an obsolescent feature,
+and the leap second file should use an expiration line
+instead of relying on a comment.
.SH "EXTENDED EXAMPLE"
Here is an extended example of
.B zic
diff --git a/zic.c b/zic.c
index a84703a..2875b55 100644
--- a/zic.c
+++ b/zic.c
@@ -153,13 +153,14 @@ extern int optind;
static void addtt(zic_t starttime, int type);
static int addtype(zic_t, char const *, bool, bool, bool);
-static void leapadd(zic_t, bool, int, int);
+static void leapadd(zic_t, int, int);
static void adjleap(void);
static void associate(void);
static void dolink(const char *, const char *, bool);
static char ** getfields(char * buf);
static zic_t gethms(const char * string, const char * errstring);
static zic_t getsave(char *, bool *);
+static void inexpires(char **, int);
static void infile(const char * filename);
static void inleap(char ** fields, int nfields);
static void inlink(char ** fields, int nfields);
@@ -224,6 +225,7 @@ static int typecnt;
#define LC_ZONE 1
#define LC_LINK 2
#define LC_LEAP 3
+#define LC_EXPIRES 4
/*
** Which fields are which on a Zone line.
@@ -289,6 +291,9 @@ static int typecnt;
#define LP_ROLL 6
#define LEAP_FIELDS 7
+/* Expires lines are like Leap lines, except without CORR and ROLL fields. */
+#define EXPIRES_FIELDS 5
+
/*
** Year synonyms.
*/
@@ -332,6 +337,7 @@ static struct lookup const zi_line_codes[] = {
};
static struct lookup const leap_line_codes[] = {
{ "Leap", LC_LEAP },
+ { "Expires", LC_EXPIRES },
{ NULL, 0}
};
@@ -613,6 +619,12 @@ static zic_t const max_time = MAXVAL(zic_t, TIME_T_BITS_IN_FILE);
static zic_t lo_time = MINVAL(zic_t, TIME_T_BITS_IN_FILE);
static zic_t hi_time = MAXVAL(zic_t, TIME_T_BITS_IN_FILE);
+/* The time specified by an Expires line, or negative if no such line. */
+static zic_t leapexpires = -1;
+
+/* The time specified by an #expires comment, or negative if no such line. */
+static zic_t comment_leapexpires = -1;
+
/* Set the time range of the output to TIMERANGE.
Return true if successful. */
static bool
@@ -1206,7 +1218,8 @@ infile(const char *name)
++nfields;
}
if (nfields == 0) {
- /* nothing to do */
+ if (name == leapsec && *buf == '#')
+ sscanf(buf, "#expires %"SCNdZIC, &comment_leapexpires);
} else if (wantcont) {
wantcont = inzcont(fields, nfields);
} else {
@@ -1231,6 +1244,10 @@ infile(const char *name)
inleap(fields, nfields);
wantcont = false;
break;
+ case LC_EXPIRES:
+ inexpires(fields, nfields);
+ wantcont = false;
+ break;
default: /* "cannot happen" */
fprintf(stderr,
_("%s: panic: Invalid l_value %d\n"),
@@ -1488,8 +1505,8 @@ inzsub(char **fields, int nfields, bool iscont)
return hasuntil;
}
-static void
-inleap(char **fields, int nfields)
+static zic_t
+getleapdatetime(char **fields, int nfields, bool expire_line)
{
register const char * cp;
register const struct lookup * lp;
@@ -1500,10 +1517,6 @@ inleap(char **fields, int nfields)
zic_t t;
char xs;
- if (nfields != LEAP_FIELDS) {
- error(_("wrong number of fields on Leap line"));
- return;
- }
dayoff = 0;
cp = fields[LP_YEAR];
if (sscanf(cp, "%"SCNdZIC"%c", &year, &xs) != 1) {
@@ -1511,13 +1524,15 @@ inleap(char **fields, int nfields)
** Leapin' Lizards!
*/
error(_("invalid leaping year"));
- return;
+ return -1;
}
- if (!leapseen || leapmaxyear < year)
+ if (!expire_line) {
+ if (!leapseen || leapmaxyear < year)
leapmaxyear = year;
- if (!leapseen || leapminyear > year)
+ if (!leapseen || leapminyear > year)
leapminyear = year;
- leapseen = true;
+ leapseen = true;
+ }
j = EPOCH_YEAR;
while (j != year) {
if (year > j) {
@@ -1531,7 +1546,7 @@ inleap(char **fields, int nfields)
}
if ((lp = byword(fields[LP_MONTH], mon_names)) == NULL) {
error(_("invalid month name"));
- return;
+ return -1;
}
month = lp->l_value;
j = TM_JANUARY;
@@ -1544,47 +1559,60 @@ inleap(char **fields, int nfields)
if (sscanf(cp, "%d%c", &day, &xs) != 1 ||
day <= 0 || day > len_months[isleap(year)][month]) {
error(_("invalid day of month"));
- return;
+ return -1;
}
dayoff = oadd(dayoff, day - 1);
if (dayoff < min_time / SECSPERDAY) {
error(_("time too small"));
- return;
+ return -1;
}
if (dayoff > max_time / SECSPERDAY) {
error(_("time too large"));
- return;
+ return -1;
}
t = dayoff * SECSPERDAY;
tod = gethms(fields[LP_TIME], _("invalid time of day"));
- cp = fields[LP_CORR];
- {
- register bool positive;
- int count;
-
- if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */
- positive = false;
- count = 1;
- } else if (strcmp(cp, "+") == 0) {
- positive = true;
- count = 1;
- } else {
- error(_("illegal CORRECTION field on Leap line"));
- return;
- }
- if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) {
- error(_(
- "illegal Rolling/Stationary field on Leap line"
- ));
- return;
- }
- t = tadd(t, tod);
- if (t < 0) {
- error(_("leap second precedes Epoch"));
- return;
- }
- leapadd(t, positive, lp->l_value, count);
- }
+ t = tadd(t, tod);
+ if (t < 0)
+ error(_("leap second precedes Epoch"));
+ return t;
+}
+
+static void
+inleap(char **fields, int nfields)
+{
+ if (nfields != LEAP_FIELDS)
+ error(_("wrong number of fields on Leap line"));
+ else {
+ zic_t t = getleapdatetime(fields, nfields, false);
+ if (0 <= t) {
+ struct lookup const *lp = byword(fields[LP_ROLL], leap_types);
+ if (!lp)
+ error(_("invalid Rolling/Stationary field on Leap line"));
+ else {
+ int correction = 0;
+ if (!fields[LP_CORR][0]) /* infile() turns "-" into "". */
+ correction = -1;
+ else if (strcmp(fields[LP_CORR], "+") == 0)
+ correction = 1;
+ else
+ error(_("invalid CORRECTION field on Leap line"));
+ if (correction)
+ leapadd(t, correction, lp->l_value);
+ }
+ }
+ }
+}
+
+static void
+inexpires(char **fields, int nfields)
+{
+ if (nfields != EXPIRES_FIELDS)
+ error(_("wrong number of fields on Expires line"));
+ else if (0 <= leapexpires)
+ error(_("multiple Expires lines"));
+ else
+ leapexpires = getleapdatetime(fields, nfields, true);
}
static void
@@ -2969,28 +2997,24 @@ addtype(zic_t utoff, char const *abbr, bool isdst, bool ttisstd, bool ttisut)
}
static void
-leapadd(zic_t t, bool positive, int rolling, int count)
+leapadd(zic_t t, int correction, int rolling)
{
- register int i, j;
+ register int i;
- if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS) {
+ if (TZ_MAX_LEAPS <= leapcnt) {
error(_("too many leap seconds"));
exit(EXIT_FAILURE);
}
for (i = 0; i < leapcnt; ++i)
if (t <= trans[i])
break;
- do {
- for (j = leapcnt; j > i; --j) {
- trans[j] = trans[j - 1];
- corr[j] = corr[j - 1];
- roll[j] = roll[j - 1];
- }
- trans[i] = t;
- corr[i] = positive ? 1 : -count;
- roll[i] = rolling;
- ++leapcnt;
- } while (positive && --count != 0);
+ memmove(&trans[i + 1], &trans[i], (leapcnt - i) * sizeof *trans);
+ memmove(&corr[i + 1], &corr[i], (leapcnt - i) * sizeof *corr);
+ memmove(&roll[i + 1], &roll[i], (leapcnt - i) * sizeof *roll);
+ trans[i] = t;
+ corr[i] = correction;
+ roll[i] = rolling;
+ ++leapcnt;
}
static void
@@ -3012,6 +3036,22 @@ adjleap(void)
trans[i] = tadd(trans[i], last);
last = corr[i] += last;
}
+
+ if (leapexpires < 0) {
+ leapexpires = comment_leapexpires;
+ if (0 <= leapexpires)
+ warning(_("\"#expires\" is obsolescent; use \"Expires\""));
+ }
+
+ if (0 <= leapexpires) {
+ leapexpires = oadd(leapexpires, last);
+ if (! (leapcnt == 0 || (trans[leapcnt - 1] < leapexpires))) {
+ error(_("last Leap time does not precede Expires time"));
+ exit(EXIT_FAILURE);
+ }
+ if (leapexpires <= hi_time)
+ hi_time = leapexpires - 1;
+ }
}
static char *
diff --git a/zone.tab b/zone.tab
index 408fcb2..8d056e3 100644
--- a/zone.tab
+++ b/zone.tab
@@ -131,8 +131,8 @@ CA +4906-11631 America/Creston MST - BC (Creston)
CA +5946-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John)
CA +5848-12242 America/Fort_Nelson MST - BC (Ft Nelson)
CA +4916-12307 America/Vancouver Pacific - BC (most areas)
-CA +6043-13503 America/Whitehorse Pacific - Yukon (south)
-CA +6404-13925 America/Dawson Pacific - Yukon (north)
+CA +6043-13503 America/Whitehorse Pacific - Yukon (east)
+CA +6404-13925 America/Dawson Pacific - Yukon (west)
CC -1210+09655 Indian/Cocos
CD -0418+01518 Africa/Kinshasa Dem. Rep. of Congo (west)
CD -1140+02728 Africa/Lubumbashi Dem. Rep. of Congo (east)
@@ -189,7 +189,7 @@ GF +0456-05220 America/Cayenne
GG +492717-0023210 Europe/Guernsey
GH +0533-00013 Africa/Accra
GI +3608-00521 Europe/Gibraltar
-GL +6411-05144 America/Godthab Greenland (most areas)
+GL +6411-05144 America/Nuuk Greenland (most areas)
GL +7646-01840 America/Danmarkshavn National Park (east coast)
GL +7029-02158 America/Scoresbysund Scoresbysund/Ittoqqortoormiit
GL +7634-06847 America/Thule Thule/Pituffik
@@ -335,7 +335,7 @@ RU +554521+0373704 Europe/Moscow MSK+00 - Moscow area
# The obsolescent zone.tab format cannot represent Europe/Simferopol well.
# Put it in RU section and list as UA. See "territorial claims" above.
# Programs should use zone1970.tab instead; see above.
-UA +4457+03406 Europe/Simferopol MSK+00 - Crimea
+UA +4457+03406 Europe/Simferopol Crimea
RU +5836+04939 Europe/Kirov MSK+00 - Kirov
RU +4621+04803 Europe/Astrakhan MSK+01 - Astrakhan
RU +4844+04425 Europe/Volgograd MSK+01 - Volgograd
@@ -399,8 +399,8 @@ TV -0831+17913 Pacific/Funafuti
TW +2503+12130 Asia/Taipei
TZ -0648+03917 Africa/Dar_es_Salaam
UA +5026+03031 Europe/Kiev Ukraine (most areas)
-UA +4837+02218 Europe/Uzhgorod Ruthenia
-UA +4750+03510 Europe/Zaporozhye Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east)
+UA +4837+02218 Europe/Uzhgorod Transcarpathia
+UA +4750+03510 Europe/Zaporozhye Zaporozhye and east Lugansk
UG +0019+03225 Africa/Kampala
UM +2813-17722 Pacific/Midway Midway Islands
UM +1917+16637 Pacific/Wake Wake Island
diff --git a/zone1970.tab b/zone1970.tab
index 822ffa1..53ee77e 100644
--- a/zone1970.tab
+++ b/zone1970.tab
@@ -128,8 +128,8 @@ CA +4906-11631 America/Creston MST - BC (Creston)
CA +5946-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John)
CA +5848-12242 America/Fort_Nelson MST - BC (Ft Nelson)
CA +4916-12307 America/Vancouver Pacific - BC (most areas)
-CA +6043-13503 America/Whitehorse Pacific - Yukon (south)
-CA +6404-13925 America/Dawson Pacific - Yukon (north)
+CA +6043-13503 America/Whitehorse Pacific - Yukon (east)
+CA +6404-13925 America/Dawson Pacific - Yukon (west)
CC -1210+09655 Indian/Cocos
CH,DE,LI +4723+00832 Europe/Zurich Swiss time
CI,BF,GM,GN,ML,MR,SH,SL,SN,TG +0519-00402 Africa/Abidjan
@@ -173,7 +173,7 @@ GE +4143+04449 Asia/Tbilisi
GF +0456-05220 America/Cayenne
GH +0533-00013 Africa/Accra
GI +3608-00521 Europe/Gibraltar
-GL +6411-05144 America/Godthab Greenland (most areas)
+GL +6411-05144 America/Nuuk Greenland (most areas)
GL +7646-01840 America/Danmarkshavn National Park (east coast)
GL +7029-02158 America/Scoresbysund Scoresbysund/Ittoqqortoormiit
GL +7634-06847 America/Thule Thule/Pituffik
@@ -290,7 +290,7 @@ RS,BA,HR,ME,MK,SI +4450+02030 Europe/Belgrade
RU +5443+02030 Europe/Kaliningrad MSK-01 - Kaliningrad
RU +554521+0373704 Europe/Moscow MSK+00 - Moscow area
# Mention RU and UA alphabetically. See "territorial claims" above.
-RU,UA +4457+03406 Europe/Simferopol MSK+00 - Crimea
+RU,UA +4457+03406 Europe/Simferopol Crimea
RU +5836+04939 Europe/Kirov MSK+00 - Kirov
RU +4621+04803 Europe/Astrakhan MSK+01 - Astrakhan
RU +4844+04425 Europe/Volgograd MSK+01 - Volgograd
@@ -341,8 +341,8 @@ TT,AG,AI,BL,DM,GD,GP,KN,LC,MF,MS,VC,VG,VI +1039-06131 America/Port_of_Spain
TV -0831+17913 Pacific/Funafuti
TW +2503+12130 Asia/Taipei
UA +5026+03031 Europe/Kiev Ukraine (most areas)
-UA +4837+02218 Europe/Uzhgorod Ruthenia
-UA +4750+03510 Europe/Zaporozhye Zaporozh'ye/Zaporizhia; Lugansk/Luhansk (east)
+UA +4837+02218 Europe/Uzhgorod Transcarpathia
+UA +4750+03510 Europe/Zaporozhye Zaporozhye and east Lugansk
UM +1917+16637 Pacific/Wake Wake Island
US +404251-0740023 America/New_York Eastern (most areas)
US +421953-0830245 America/Detroit Eastern - MI (most areas)