summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart.bishop@canonical.com>2019-04-10 11:52:23 +1000
committerStuart Bishop <stuart.bishop@canonical.com>2019-04-10 11:52:23 +1000
commit9eceee2ce7571e8c4d80ef8791f6df5ed1b5f190 (patch)
tree436d831c38aac059fd146c32a5069ccaa05fd05b
parent78d76e59e52761b30cdf413be23d7d5e57ed416c (diff)
parentf4f60e51e68a503e24efe20f31ab2f4a3bf1cc20 (diff)
downloadpytz-git-9eceee2ce7571e8c4d80ef8791f6df5ed1b5f190.tar.gz
IANA 2019a
-rw-r--r--tz/Makefile29
-rw-r--r--tz/NEWS53
-rw-r--r--tz/README4
-rw-r--r--tz/africa10
-rw-r--r--tz/asia42
-rw-r--r--tz/backward3
-rw-r--r--tz/backzone4
-rw-r--r--tz/etcetera1
-rw-r--r--tz/europe4
-rw-r--r--tz/iso3166.tab8
-rw-r--r--tz/leap-seconds.list8
-rw-r--r--tz/northamerica11
-rw-r--r--tz/theory.html91
-rw-r--r--tz/tz-art.html4
-rw-r--r--tz/tz-link.html19
-rw-r--r--tz/tzfile.514
-rw-r--r--tz/tzfile.h3
-rw-r--r--tz/zic.847
-rw-r--r--tz/zic.c264
19 files changed, 463 insertions, 156 deletions
diff --git a/tz/Makefile b/tz/Makefile
index d8d8e21..25f1d35 100644
--- a/tz/Makefile
+++ b/tz/Makefile
@@ -12,7 +12,10 @@ VERSION= unknown
# Email address for bug reports.
BUGEMAIL= tz@iana.org
-# Choose source data features. To get new features right away, use:
+# DATAFORM selects the data format.
+# Available formats represent essentially the same data, albeit
+# possibly with minor discrepancies that users are not likely to notice.
+# To get new features and the best data right away, use:
# DATAFORM= vanguard
# To wait a while before using new features, to give downstream users
# time to upgrade zic (the default), use:
@@ -33,11 +36,11 @@ DATAFORM= main
LOCALTIME= GMT
# If you want something other than Eastern United States time as a template
-# for handling POSIX-style timezone environment variables,
+# for handling ruleless POSIX-style timezone environment variables,
# change the line below (after finding the timezone you want in the
# one of the $(TDATA) source files, or adding it to a source file).
-# When a POSIX-style environment variable is handled, the rules in the
-# template file are used to determine "spring forward" and "fall back" days and
+# A ruleless environment setting like TZ='CST6CDT' uses the rules in the
+# template file to determine "spring forward" and "fall back" days and
# times; the environment variable itself specifies UT offsets of standard and
# daylight saving time.
# Alternatively, if you discover you've got the wrong timezone, you can just
@@ -46,7 +49,6 @@ LOCALTIME= GMT
# Use the command
# make zonenames
# to get a list of the values you can use for POSIXRULES.
-# If you want POSIX compatibility, use "America/New_York".
POSIXRULES= America/New_York
@@ -113,8 +115,8 @@ TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
TIME_T_ALTERNATIVES_HEAD = int64_t
TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
-# What kind of TZif data files to generate.
-# (TZif is the binary time zone data format that zic generates.)
+# What kind of TZif data files to generate. (TZif is the binary time
+# zone data format that zic generates; see Internet RFC 8536.)
# If you want only POSIX time, with time values interpreted as
# seconds since the epoch (not counting leap seconds), use
# REDO= posix_only
@@ -360,6 +362,9 @@ LEAPSECONDS=
zic= ./zic
ZIC= $(zic) $(ZFLAGS)
+# To shrink the size of installed TZif files,
+# append "-r @N" to omit data before N-seconds-after-the-Epoch.
+# See the zic man page for more about -r.
ZFLAGS=
# How to use zic to install TZif files.
@@ -491,7 +496,8 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
COMMON= calendars CONTRIBUTING LICENSE Makefile \
NEWS README theory.html version
WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
-CHECK_WEB_PAGES=check_tz-art.html check_tz-how-to.html check_tz-link.html
+CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
+ check_tz-how-to.html check_tz-link.html
DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
PRIMARY_YDATA= africa antarctica asia australasia \
europe northamerica southamerica
@@ -804,9 +810,10 @@ check_tzs: $(TZS) $(TZS_NEW)
touch $@
check_web: $(CHECK_WEB_PAGES)
+check_theory.html: theory.html
check_tz-art.html: tz-art.html
check_tz-link.html: tz-link.html
-check_tz-art.html check_tz-link.html:
+check_theory.html check_tz-art.html check_tz-link.html:
$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
-F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
test ! -s $@.out || { cat $@.out; exit 1; }
@@ -840,11 +847,13 @@ check_zishrink_posix check_zishrink_right: \
touch $@
clean_misc:
+ rm -fr check_*.dir
rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
check_* core typecheck_* \
date tzselect version.h zdump zic yearistype libtz.a
clean: clean_misc
- rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
+ rm -fr *.dir tzdb-*/
+ rm -f *.zi $(TZS_NEW)
maintainer-clean: clean
@echo 'This command is intended for maintainers to use; it'
diff --git a/tz/NEWS b/tz/NEWS
index 37f2281..9d0e9c0 100644
--- a/tz/NEWS
+++ b/tz/NEWS
@@ -1,5 +1,53 @@
News for the tz database
+Release 20198 - 2019-03-25 22:01:33 -0700
+
+ Briefly:
+ Palestine "springs forward" on 2019-03-30 instead of 2019-03-23.
+ Metlakatla "fell back" to rejoin Alaska Time on 2019-01-20 at 02:00.
+
+ Changes to past and future timestamps
+
+ Palestine will not start DST until 2019-03-30, instead of 2019-03-23 as
+ previously predicted. Adjust our prediction by guessing that spring
+ transitions will be between 24 and 30 March, which matches recent practice
+ since 2016. (Thanks to Even Scharning and Tim Parenti.)
+
+ Metlakatla ended its observance of Pacific standard time,
+ rejoining Alaska Time, on 2019-01-20 at 02:00. (Thanks to Ryan
+ Stanley and Tim Parenti.)
+
+ Changes to past timestamps
+
+ Israel observed DST in 1980 (08-02/09-13) and 1984 (05-05/08-25).
+ (Thanks to Alois Treindl and Isaac Starkman.)
+
+ Changes to time zone abbreviations
+
+ Etc/UCT is now a backward-compatibility link to Etc/UTC, instead
+ of being a separate zone that generates the abbreviation "UCT",
+ which nowadays is typically a typo. (Problem reported by Isiah
+ Meadows.)
+
+ Changes to code
+
+ zic now has an -r option to limit the time range of output data.
+ For example, 'zic -r @1000000000' limits the output data to
+ timestamps starting 1000000000 seconds after the Epoch.
+ This helps shrink output size and can be useful for applications
+ not needing the full timestamp history, such as TZDIST truncation;
+ see Internet RFC 8536 section 5.1. (Inspired by a feature request
+ from Christopher Wong, helped along by bug reports from Wong and
+ from Tim Parenti.)
+
+ Changes to documentation
+
+ Mention Internet RFC 8536 (February 2019), which documents TZif.
+
+ tz-link.html now cites tzdata-meta
+ <https://tzdata-meta.timtimeonline.com/>.
+
+
Release 2018i - 2018-12-30 11:05:43 -0800
Briefly:
@@ -400,8 +448,9 @@ Release 2018d - 2018-03-22 07:05:46 -0700
downstream parsers do not support it.
* The build procedure constructs three files vanguard.zi, main.zi,
- and rearguard.zi, one for each format. The files represent the
- same data as closely as the formats allow. These three files
+ and rearguard.zi, one for each format. Although the files
+ represent essentially the same data, they may have minor
+ discrepancies that users are not likely to notice. The files
are intended for downstream data consumers and are not
installed. Zoneinfo parsers that do not support negative SAVE values
should start using rearguard.zi, so that they will be unaffected
diff --git a/tz/README b/tz/README
index efe7a17..dd6fcf7 100644
--- a/tz/README
+++ b/tz/README
@@ -1,7 +1,7 @@
README for the tz distribution
-"What time is it?" -- Richard Deacon as The King
-"Any time you want it to be." -- Frank Baxter as The Scientist
+"Where do I set the hands of the clock?" -- Les Tremayne as The King
+"Oh that--you can set them any place you want." -- Frank Baxter as The Scientist
(from the Bell System film "About Time")
The Time Zone Database (called tz, tzdb or zoneinfo) contains code and
diff --git a/tz/africa b/tz/africa
index 0a0f586..a58c11c 100644
--- a/tz/africa
+++ b/tz/africa
@@ -364,6 +364,11 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
# See Africa/Lagos.
# Eritrea
+# See Africa/Nairobi.
+
+# Eswatini (formerly Swaziland)
+# See Africa/Johannesburg.
+
# Ethiopia
# See Africa/Nairobi.
#
@@ -1188,7 +1193,7 @@ Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8
1:30 - SAST 1903 Mar
2:00 SA SAST
Link Africa/Johannesburg Africa/Maseru # Lesotho
-Link Africa/Johannesburg Africa/Mbabane # Swaziland
+Link Africa/Johannesburg Africa/Mbabane # Eswatini
#
# Marion and Prince Edward Is
# scientific station since 1947
@@ -1230,9 +1235,6 @@ Zone Africa/Juba 2:06:28 - LMT 1931
2:00 Sudan CA%sT 2000 Jan 15 12:00
3:00 - EAT
-# Swaziland
-# See Africa/Johannesburg.
-
# Tanzania
# See Africa/Nairobi.
diff --git a/tz/asia b/tz/asia
index 3165203..d790da5 100644
--- a/tz/asia
+++ b/tz/asia
@@ -1620,6 +1620,24 @@ Rule Zion 1974 only - Jul 7 0:00 1:00 D
Rule Zion 1974 only - Oct 13 0:00 0 S
Rule Zion 1975 only - Apr 20 0:00 1:00 D
Rule Zion 1975 only - Aug 31 0:00 0 S
+
+# From Alois Treindl (2019-03-06):
+# http://www.moin.gov.il/Documents/שעון קיץ/clock-50-years-7-2014.pdf
+# From Isaac Starkman (2019-03-06):
+# Summer time was in that period in 1980 and 1984, see
+# https://www.ynet.co.il/articles/0,7340,L-3951073,00.html
+# You can of course read it in translation.
+# I checked the local newspapers for that years.
+# It started on midnight and end at 01.00 am.
+# From Paul Eggert (2019-03-06):
+# Also see this thread about the moin.gov.il URL:
+# https://mm.icann.org/pipermail/tz/2018-November/027194.html
+Rule Zion 1980 only - Aug 2 0:00 1:00 D
+Rule Zion 1980 only - Sep 13 1:00 0 S
+Rule Zion 1984 only - May 5 0:00 1:00 D
+Rule Zion 1984 only - Aug 25 1:00 0 S
+
+# From Shanks & Pottenger:
Rule Zion 1985 only - Apr 14 0:00 1:00 D
Rule Zion 1985 only - Sep 15 0:00 0 S
Rule Zion 1986 only - May 18 0:00 1:00 D
@@ -3071,9 +3089,15 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
# the official website, though the decree did not specify the exact
# time of the time shift.
# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817
+
+# From Even Scharning (2019-03-23):
+# DST in Palestine will start on 30 March this year, not 23 March as the time
+# zone database predicted.
+# https://ramallah.news/post/123610
#
-# From Paul Eggert (2018-03-16):
-# For 2016 on, predict spring transitions on March's fourth Saturday at 01:00.
+# From Tim Parenti (2019-03-23):
+# Combining this with the rules observed since 2016, adjust our spring
+# transition guess to Mar Sat>=24.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule EgyptAsia 1957 only - May 10 0:00 1:00 S
@@ -3104,7 +3128,7 @@ Rule Palestine 2012 only - Sep 21 1:00 0 -
Rule Palestine 2013 only - Sep Fri>=21 0:00 0 -
Rule Palestine 2014 2015 - Oct Fri>=21 0:00 0 -
Rule Palestine 2015 only - Mar lastFri 24:00 1:00 S
-Rule Palestine 2016 max - Mar Sat>=22 1:00 1:00 S
+Rule Palestine 2016 max - Mar Sat>=24 1:00 1:00 S
Rule Palestine 2016 max - Oct lastSat 1:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -3596,5 +3620,17 @@ Zone Asia/Ho_Chi_Minh 7:06:40 - LMT 1906 Jul 1
8:00 - +08 1975 Jun 13
7:00 - +07
+# From Paul Eggert (2019-02-19):
+#
+# The Ho Chi Minh entry suffices for most purposes as it agrees with all of
+# Vietnam since 1975-06-13. Presumably clocks often changed in south Vietnam
+# in the early 1970s as locations changed hands during the war; however the
+# details are unknown and would likely be too voluminous for this database.
+#
+# For timestamps in north Vietnam back to 1970 (the tzdb cutoff),
+# use Asia/Bangkok; see the VN entries in the file zone1970.tab.
+# For timestamps before 1970, see Asia/Hanoi in the file 'backzone'.
+
+
# Yemen
# See Asia/Riyadh.
diff --git a/tz/backward b/tz/backward
index 51e10f4..b4ae3cf 100644
--- a/tz/backward
+++ b/tz/backward
@@ -77,6 +77,7 @@ Link Pacific/Easter Chile/EasterIsland
Link America/Havana Cuba
Link Africa/Cairo Egypt
Link Europe/Dublin Eire
+Link Etc/UTC Etc/UCT
Link Europe/London Europe/Belfast
Link Europe/Chisinau Europe/Tiraspol
Link Europe/London GB
@@ -111,7 +112,7 @@ Link Asia/Taipei ROC
Link Asia/Seoul ROK
Link Asia/Singapore Singapore
Link Europe/Istanbul Turkey
-Link Etc/UCT UCT
+Link Etc/UTC UCT
Link America/Anchorage US/Alaska
Link America/Adak US/Aleutian
Link America/Phoenix US/Arizona
diff --git a/tz/backzone b/tz/backzone
index 97792b1..380c492 100644
--- a/tz/backzone
+++ b/tz/backzone
@@ -204,7 +204,7 @@ Zone Africa/Maseru 1:50:00 - LMT 1903 Mar
2:00 1:00 SAST 1944 Mar 19 2:00
2:00 - SAST
-# Swaziland
+# Eswatini (formerly Swaziland)
Zone Africa/Mbabane 2:04:24 - LMT 1903 Mar
2:00 - SAST
@@ -625,7 +625,7 @@ Zone Europe/Sarajevo 1:13:40 - LMT 1884
1:00 - CET 1982 Nov 27
1:00 EU CE%sT
-# Macedonia
+# North Macedonia
Zone Europe/Skopje 1:25:44 - LMT 1884
1:00 - CET 1941 Apr 18 23:00
1:00 C-Eur CE%sT 1945 May 8 2:00s
diff --git a/tz/etcetera b/tz/etcetera
index 91ded93..a1606bd 100644
--- a/tz/etcetera
+++ b/tz/etcetera
@@ -19,7 +19,6 @@
Zone Etc/GMT 0 - GMT
Zone Etc/UTC 0 - UTC
-Zone Etc/UCT 0 - UCT
# The following link uses older naming conventions,
# but it belongs here, not in the file 'backward',
diff --git a/tz/europe b/tz/europe
index 587f7b0..b735a48 100644
--- a/tz/europe
+++ b/tz/europe
@@ -1855,7 +1855,7 @@ Zone Europe/Luxembourg 0:24:36 - LMT 1904 Jun
1:00 Belgium CE%sT 1977
1:00 EU CE%sT
-# Macedonia
+# North Macedonia
# See Europe/Belgrade.
# Malta
@@ -3359,7 +3359,7 @@ Zone Europe/Belgrade 1:22:00 - LMT 1884
Link Europe/Belgrade Europe/Ljubljana # Slovenia
Link Europe/Belgrade Europe/Podgorica # Montenegro
Link Europe/Belgrade Europe/Sarajevo # Bosnia and Herzegovina
-Link Europe/Belgrade Europe/Skopje # Macedonia
+Link Europe/Belgrade Europe/Skopje # North Macedonia
Link Europe/Belgrade Europe/Zagreb # Croatia
# Slovakia
diff --git a/tz/iso3166.tab b/tz/iso3166.tab
index c2e0f8e..a4ff61a 100644
--- a/tz/iso3166.tab
+++ b/tz/iso3166.tab
@@ -9,8 +9,8 @@
# All text uses UTF-8 encoding. The columns of the table are as follows:
#
# 1. ISO 3166-1 alpha-2 country code, current as of
-# ISO 3166-1 N905 (2016-11-15). See: Updates on ISO 3166-1
-# http://isotc.iso.org/livelink/livelink/Open/16944257
+# ISO 3166-1 N976 (2018-11-06). See: Updates on ISO 3166-1
+# https://isotc.iso.org/livelink/livelink/Open/16944257
# 2. The usual English name for the coded region,
# chosen so that alphabetic sorting of subsets produces helpful lists.
# This is not the same as the English name in the ISO 3166 tables.
@@ -166,7 +166,7 @@ ME Montenegro
MF St Martin (French)
MG Madagascar
MH Marshall Islands
-MK Macedonia
+MK North Macedonia
ML Mali
MM Myanmar (Burma)
MN Mongolia
@@ -235,7 +235,7 @@ ST Sao Tome & Principe
SV El Salvador
SX St Maarten (Dutch)
SY Syria
-SZ Swaziland
+SZ Eswatini (Swaziland)
TC Turks & Caicos Is
TD Chad
TF French Southern & Antarctic Lands
diff --git a/tz/leap-seconds.list b/tz/leap-seconds.list
index cf54b9a..fd3d192 100644
--- a/tz/leap-seconds.list
+++ b/tz/leap-seconds.list
@@ -204,10 +204,10 @@
# current -- the update time stamp, the data and the name of the file
# will not change.
#
-# Updated through IERS Bulletin C56
-# File expires on: 28 June 2019
+# Updated through IERS Bulletin C57
+# File expires on: 28 December 2019
#
-#@ 3770668800
+#@ 3786480000
#
2272060800 10 # 1 Jan 1972
2287785600 11 # 1 Jul 1972
@@ -252,4 +252,4 @@
# the hash line is also ignored in the
# computation.
#
-#h 62ca19f6 96a4ae0a 3708451c 9f8693f4 016604eb
+#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a
diff --git a/tz/northamerica b/tz/northamerica
index faaf979..eee8de0 100644
--- a/tz/northamerica
+++ b/tz/northamerica
@@ -609,6 +609,15 @@ Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 12:07:02
# In a 2018-12-11 special election, Metlakatla voted to go back to
# Alaska time (including daylight saving time) starting next year.
# https://www.krbd.org/2018/12/12/metlakatla-to-follow-alaska-standard-time-allow-liquor-sales/
+#
+# From Ryan Stanley (2019-01-11):
+# The community will be changing back on the 20th of this month...
+# From Tim Parenti (2019-01-11):
+# Per an announcement on the Metlakatla community's official Facebook page, the
+# "fall back" will be on Sunday 2019-01-20 at 02:00:
+# https://www.facebook.com/141055983004923/photos/607150969728753/
+# So they won't be waiting for Alaska to join them on 2019-03-10, but will
+# rather change their clocks twice in seven weeks.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Juneau 15:02:19 - LMT 1867 Oct 19 15:33:32
@@ -637,7 +646,7 @@ Zone America/Metlakatla 15:13:42 - LMT 1867 Oct 19 15:44:55
-8:00 US P%sT 1983 Oct 30 2:00
-8:00 - PST 2015 Nov 1 2:00
-9:00 US AK%sT 2018 Nov 4 2:00
- -8:00 - PST 2019 Mar Sun>=8 3:00
+ -8:00 - PST 2019 Jan 20 2:00
-9:00 US AK%sT
Zone America/Yakutat 14:41:05 - LMT 1867 Oct 19 15:12:18
-9:18:55 - LMT 1900 Aug 20 12:00
diff --git a/tz/theory.html b/tz/theory.html
index a8da065..e373022 100644
--- a/tz/theory.html
+++ b/tz/theory.html
@@ -15,7 +15,7 @@
<ul>
<li><a href="#scope">Scope of the <code><abbr>tz</abbr></code>
database</a></li>
- <li><a href="#naming">Names of timezones</a></li>
+ <li><a href="#naming">Timezone identifiers</a></li>
<li><a href="#abbreviations">Time zone abbreviations</a></li>
<li><a href="#accuracy">Accuracy of the <code><abbr>tz</abbr></code>
database</a></li>
@@ -107,9 +107,9 @@ It does not always make sense to talk about a timezone's
</section>
<section>
- <h2 id="naming">Names of timezones</h2>
+ <h2 id="naming">Timezone identifiers</h2>
<p>
-Each timezone has a unique name.
+Each timezone has a name that uniquely identifies the timezone.
Inexperienced users are not expected to select these names unaided.
Distributors should provide documentation and/or a simple selection
interface that explains each name via a map or via descriptive text like
@@ -142,10 +142,12 @@ among the following goals:
</li>
<li>
Be robust in the presence of political changes.
- For example, names of countries are ordinarily not used, to avoid
+ For example, names are typically not tied to countries, to avoid
incompatibilities when countries change their name (e.g.,
- Zaire&rarr;Congo) or when locations change countries (e.g., Hong
+ Swaziland&rarr;Eswatini) or when locations change countries (e.g., Hong
Kong from UK colony to China).
+ There is no requirement that every country or national
+ capital must have a timezone name.
</li>
<li>
Be portable to a wide variety of implementations.
@@ -215,19 +217,18 @@ in decreasing order of importance:
do not need locations, since local time is not defined there.
</li>
<li>
- There should typically be at least one name for each <a
- href="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr
- title="International Organization for Standardization">ISO</abbr>
- 3166-1</a> officially assigned two-letter code for an inhabited
- country or territory.
- </li>
- <li>
If all the clocks in a timezone have agreed since 1970,
do not bother to include more than one timezone
even if some of the clocks disagreed before 1970.
Otherwise these tables would become annoyingly large.
</li>
<li>
+ If boundaries between regions are fluid, such as during a war or
+ insurrection, do not bother to create a new timezone merely
+ because of yet another boundary change. This helps prevent table
+ bloat and simplifies maintenance.
+ </li>
+ <li>
If a name is ambiguous, use a less ambiguous alternative;
e.g., many cities are named San José and Georgetown, so
prefer <code>America/Costa_Rica</code> to
@@ -299,29 +300,23 @@ in decreasing order of importance:
</ul>
<p>
-The file '<code>zone1970.tab</code>' lists geographical locations used
-to name timezones.
-It is intended to be an exhaustive list of names for geographic
-regions as described above; this is a subset of the timezones in the data.
-Although a '<code>zone1970.tab</code>' location's
-<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
-corresponds to
-its <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean
-time (<abbr>LMT</abbr>)</a> offset with one hour for every 15&deg;
-east longitude, this relationship is not exact.
+Guidelines have evolved with time, and names following old versions of
+this guideline might not follow the current version. When guidelines
+have changed, old names continue to be supported. Guideline changes
+have included the following:
</p>
-<p>
-Older versions of this package used a different naming scheme,
-and these older names are still supported.
+<ul>
+<li>
+Older versions of this package used a different naming scheme.
See the file '<code>backward</code>' for most of these older names
(e.g., '<code>US/Eastern</code>' instead of '<code>America/New_York</code>').
The other old-fashioned names still supported are
'<code>WET</code>', '<code>CET</code>', '<code>MET</code>', and
'<code>EET</code>' (see the file '<code>europe</code>').
-</p>
+</li>
-<p>
+<li>
Older versions of this package defined legacy names that are
incompatible with the first guideline of location names, but which are
still supported.
@@ -332,6 +327,31 @@ Also, the file '<code>backward</code>' defines the legacy names
and the file '<code>northamerica</code>' defines the legacy names
'<code>EST5EDT</code>', '<code>CST6CDT</code>',
'<code>MST7MDT</code>', and '<code>PST8PDT</code>'.
+</li>
+
+<li>
+Older versions of this guideline said that
+there should typically be at least one name for each <a
+href="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr
+title="International Organization for Standardization">ISO</abbr>
+3166-1</a> officially assigned two-letter code for an inhabited
+country or territory.
+This old guideline has been dropped, as it was not needed to handle
+timestamps correctly and it increased maintenance burden.
+</li>
+</ul>
+
+<p>
+The file '<code>zone1970.tab</code>' lists geographical locations used
+to name timezones.
+It is intended to be an exhaustive list of names for geographic
+regions as described above; this is a subset of the timezones in the data.
+Although a '<code>zone1970.tab</code>' location's
+<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
+corresponds to
+its <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean
+time (<abbr>LMT</abbr>)</a> offset with one hour for every 15&deg;
+east longitude, this relationship is not exact.
</p>
<p>
@@ -983,7 +1003,9 @@ an older <code>zic</code>.
constrained to be a string containing abbreviations
and numeric data as described <a href="#POSIX">above</a>.
The file's format is <dfn><abbr>TZif</abbr></dfn>,
- a timezone information format that contains binary data.
+ a timezone information format that contains binary data; see
+ <a href="https://tools.ietf.org/html/8536">Internet
+ <abbr>RFC</abbr> 8536</a>.
The daylight saving time rules to be used for a
particular timezone are encoded in the
<abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
@@ -1166,7 +1188,7 @@ The <code><abbr>tz</abbr></code> code and data supply the following interfaces:
<ul>
<li>
A set of timezone names as per
- "<a href="#naming">Names of timezones</a>" above.
+ "<a href="#naming">Timezone identifiers</a>" above.
</li>
<li>
Library functions described in "<a href="#functions">Time and date
@@ -1213,6 +1235,17 @@ For example, users should not rely on particular <abbr>UT</abbr>
offsets or abbreviations for timestamps, as data entries are often
based on guesswork and these guesses may be corrected or improved.
</p>
+
+<p>
+Timezone boundaries are not part of the stable interface.
+For example, even though the <samp>Asia/Bangkok</samp> timezone
+currently includes Chang Mai, Hanoi, and Phnom Penh, this is not part
+of the stable interface and the timezone can split at any time.
+If a calendar application records a future event in some location other
+than Bangkok by putting "<samp>Asia/Bangkok</samp>" in the event's record,
+the application should be robust in the presence of timezone splits
+between now and the future time.
+</p>
</section>
<section>
diff --git a/tz/tz-art.html b/tz/tz-art.html
index edddae0..32f523e 100644
--- a/tz/tz-art.html
+++ b/tz/tz-art.html
@@ -18,11 +18,11 @@ Arizona's daylight-saving enclaves quite well.</li>
with Time &amp; Timezones &ndash; Computerphile</a>" (2013; 10:12) delves
into problems that programmers have with timekeeping.</li>
<li>
-<a href="https://www.rferl.org/a/28375932.html">All The Time In The World:
+"<a href="https://www.rferl.org/a/28375932.html">All The Time In The World:
Explaining The Mysteries Of Time Zones</a>" (2017; 2:15)
briefly says why France has more time zones than Russia.
<li>
-"About Time" (1962; 53 minutes) is part of the
+"About Time" (1962; 59 minutes) is part of the
Bell Science extravaganza, with Frank Baxter, Richard Deacon, and Les Tremayne.
Its advisor was Richard Feynman, and it was voiced by Mel Blanc.
(<a href="http://www.imdb.com/title/tt0154110/">IMDb entry</a>.)</li>
diff --git a/tz/tz-link.html b/tz/tz-link.html
index 924227a..89ebd40 100644
--- a/tz/tz-link.html
+++ b/tz/tz-link.html
@@ -144,7 +144,9 @@ After obtaining the code and data files, see the
<code>README</code> file for what to do next.
The code lets you compile the <code><abbr>tz</abbr></code> source files into
machine-readable binary files, one for each location. The binary files
-are in a special timezone information format (<dfn><abbr>TZif</abbr></dfn>).
+are in a special timezone information format (<dfn><abbr>TZif</abbr></dfn>)
+specified by <a href="https://tools.ietf.org/html/8536">Internet
+<abbr>RFC</abbr> 8536</a>.
The code also lets
you read a <abbr>TZif</abbr> file and interpret timestamps for that
location.</p>
@@ -157,7 +159,11 @@ the time zone mailing list. You can also <a
href="https://mm.icann.org/mailman/listinfo/tz">subscribe</a> to it
and browse the <a
href="https://mm.icann.org/pipermail/tz/">archive of old
-messages</a>.</p>
+messages</a>.
+<a href="https://tzdata-meta.timtimeonline.com/">Metadata for mailing list
+discussions</a> and corresponding data changes can be
+generated <a href="https://github.com/timparenti/tzdata-meta">automatically</a>.
+</p>
<p>
If your government plans to change its time zone boundaries or
daylight saving rules, inform <code>tz@iana.org</code> well in
@@ -278,15 +284,12 @@ along with <a href="https://tools.ietf.org/html/rfc7809">CalDAV</a>
(Internet <abbr>RFC</abbr> 7809), a calendar access protocol for
transferring time zone data by reference.
The <a href="https://www.ietf.org/mailman/listinfo/tzdist-bis">tzdist-bis
-mailing list</a> discusses two Internet drafts: <a
+mailing list</a> discusses the Internet draft <a
id="TZDIST-Geolocate"
href="https://tools.ietf.org/html/draft-murchison-tzdist-geolocate">TZDIST
-Geolocate Extension</a> lets a client determine its timezone
+Geolocate Extension</a>, which lets a client determine its timezone
from its geographic location using a <a
-href="https://tools.ietf.org/html/rfc5870">'geo' URI</a>, and
-<a href="https://tools.ietf.org/html/draft-murchison-tzdist-tzif">The
-Time Zone Information Format (<abbr>TZif</abbr>)</a> specifies the format of
-<abbr>TZif</abbr> data.</li>
+href="https://tools.ietf.org/html/rfc5870">'geo' URI</a>.</li>
<li>The <a href="https://tools.ietf.org/html/rfc5545">
Internet Calendaring and Scheduling Core Object Specification
(iCalendar)</a> (Internet <abbr>RFC</abbr> 5445)
diff --git a/tz/tzfile.5 b/tz/tzfile.5
index bbdccfc..2f70915 100644
--- a/tz/tzfile.5
+++ b/tz/tzfile.5
@@ -15,7 +15,8 @@ The timezone information files used by
.BR tzset (3)
are typically found under a directory with a name like
.IR /usr/share/zoneinfo .
-These files begin with a 44-byte header containing the following fields:
+These files use the format described in Internet RFC 8536.
+The format begins with a 44-byte header containing the following fields:
.IP * 2
The magic four-byte ASCII sequence
.q "TZif"
@@ -384,6 +385,15 @@ of one hour, or of 15 minutes, or of 1 minute.
.BR tzset (3),
.BR tzselect (8),
.BR zdump (8),
-.BR zic (8)
+.BR zic (8).
+.PP
+Olson A, Eggert P, Murchison K. The Time Zone Information Format (TZif).
+2019 Feb.
+.UR https://\:www.rfc-editor.org/\:info/\:rfc8536
+Internet RFC 8536
+.UE
+.UR https://\:doi.org/\:10.17487/\:RFC8536
+doi:10.17487/RFC8536
+.UE .
.\" This file is in the public domain, so clarified as of
.\" 1996-06-05 by Arthur David Olson.
diff --git a/tz/tzfile.h b/tz/tzfile.h
index 27a38cc..446c8d5 100644
--- a/tz/tzfile.h
+++ b/tz/tzfile.h
@@ -33,6 +33,9 @@
#define TZDEFRULES "posixrules"
#endif /* !defined TZDEFRULES */
+
+/* See Internet RFC 8536 for more details about the following format. */
+
/*
** Each file begins with. . .
*/
diff --git a/tz/zic.8 b/tz/zic.8
index ac85e46..524a113 100644
--- a/tz/zic.8
+++ b/tz/zic.8
@@ -63,7 +63,7 @@ Link \fItimezone\fP localtime
Use
.IR timezone 's
rules when handling POSIX-format
-timezone environment variables.
+TZ strings like "CST6CDT" that lack transition rules.
.B zic
will act as if the input contained a link line of the form
.sp
@@ -79,6 +79,30 @@ Read leap second information from the file with the given name.
If this option is not used,
no leap second information appears in output files.
.TP
+.BR "\*-r " "[\fB@\fP\fIlo\fP][\fB/@\fP\fIhi\fP]"
+Reduce the size of output files by limiting their applicability
+to timestamps in the range from
+.I lo
+(inclusive) to
+.I hi
+(exclusive), where
+.I lo
+and
+.I hi
+are possibly-signed decimal counts of seconds since the Epoch
+(1970-01-01 00:00:00 UTC).
+Omitted counts default to extreme values.
+For example,
+.q "zic \*-r @0"
+omits data intended for negative timestamps (i.e., before the Epoch), and
+.q "zic \*-r @0/@2147483648"
+outputs data intended only for nonnegative timestamps that fit into
+31-bit signed integers.
+On platforms with GNU
+.BR date ,
+.q "zic \-r @$(date +%s)"
+omits data intended for past timestamps.
+.TP
.B \*-v
Be more verbose, and complain about the following situations:
.RS
@@ -102,7 +126,7 @@ prohibit this.
.PP
The output file does not contain all the information about the
long-term future of a timezone, because the future cannot be summarized as
-an extended POSIX TZ string. For example, as of 2013 this problem
+an extended POSIX TZ string. For example, as of 2019 this problem
occurs for Iran's daylight-saving rules for the predicted future, as
these rules are based on the Iranian calendar, which cannot be
represented.
@@ -125,11 +149,10 @@ or it contains a file name component that contains more than 14 bytes
or that starts with
.q "\*-" .
.RE
-.TP
-.B \*-s
-Limit time values stored in output files to values that are the same
-whether they're taken to be signed or unsigned.
-You can use this option to generate SVVS-compatible files.
+.SH FILES
+Input files use the format described in this section; output files use
+.IR tzfile (5)
+format.
.PP
Input files should be text files, that is, they should be a series of
zero or more lines, each ending in a newline byte and containing at
@@ -457,6 +480,16 @@ continuation.
.PP
If a zone changes at the same instant that a rule would otherwise take
effect in the earlier zone or continuation line, the rule is ignored.
+A zone or continuation line
+.I L
+with a named rule set starts with standard time by default:
+that is, any of
+.IR L 's
+timestamps preceding
+.IR L 's
+earliest rule use the rule in effect after
+.IR L 's
+first transition into standard time.
In a single zone it is an error if two rules take effect at the same
instant, or if two zone changes take effect at the same instant.
.PP
diff --git a/tz/zic.c b/tz/zic.c
index 2ebc66a..4bafe5d 100644
--- a/tz/zic.c
+++ b/tz/zic.c
@@ -575,7 +575,8 @@ usage(FILE *stream, int status)
fprintf(stream,
_("%s: usage is %s [ --version ] [ --help ] [ -v ] \\\n"
"\t[ -l localtime ] [ -p posixrules ] [ -d directory ] \\\n"
- "\t[ -t localtime-link ] [ -L leapseconds ] [ filename ... ]\n\n"
+ "\t[ -t localtime-link ] [ -L leapseconds ] [ -r '[@lo][/@hi]' ] \\\n"
+ "\t[ filename ... ]\n\n"
"Report bugs to %s.\n"),
progname, progname, REPORT_BUGS_TO);
if (status == EXIT_SUCCESS)
@@ -603,6 +604,45 @@ change_directory (char const *dir)
}
}
+#define TIME_T_BITS_IN_FILE 64
+
+/* The minimum and maximum values representable in a TZif file. */
+static zic_t const min_time = MINVAL(zic_t, TIME_T_BITS_IN_FILE);
+static zic_t const max_time = MAXVAL(zic_t, TIME_T_BITS_IN_FILE);
+
+/* The minimum, and one less than the maximum, values specified by
+ the -r option. These default to MIN_TIME and MAX_TIME. */
+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);
+
+/* Set the time range of the output to TIMERANGE.
+ Return true if successful. */
+static bool
+timerange_option(char *timerange)
+{
+ intmax_t lo = min_time, hi = max_time;
+ char *lo_end = timerange, *hi_end;
+ if (*timerange == '@') {
+ errno = 0;
+ lo = strtoimax (timerange + 1, &lo_end, 10);
+ if (lo_end == timerange + 1 || (lo == INTMAX_MAX && errno == ERANGE))
+ return false;
+ }
+ hi_end = lo_end;
+ if (lo_end[0] == '/' && lo_end[1] == '@') {
+ errno = 0;
+ hi = strtoimax (lo_end + 2, &hi_end, 10);
+ if (hi_end == lo_end + 2 || hi == INTMAX_MIN)
+ return false;
+ hi -= ! (hi == INTMAX_MAX && errno == ERANGE);
+ }
+ if (*hi_end || hi < lo || max_time < lo || hi < min_time)
+ return false;
+ lo_time = lo < min_time ? min_time : lo;
+ hi_time = max_time < hi ? max_time : hi;
+ return true;
+}
+
static const char * psxrules;
static const char * lcltime;
static const char * directory;
@@ -615,6 +655,7 @@ main(int argc, char **argv)
{
register int c, k;
register ptrdiff_t i, j;
+ bool timerange_given = false;
#ifdef S_IWGRP
umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
@@ -640,7 +681,7 @@ main(int argc, char **argv)
} else if (strcmp(argv[k], "--help") == 0) {
usage(stdout, EXIT_SUCCESS);
}
- while ((c = getopt(argc, argv, "d:l:L:p:st:vy:")) != EOF && c != -1)
+ while ((c = getopt(argc, argv, "d:l:L:p:r:st:vy:")) != EOF && c != -1)
switch (c) {
default:
usage(stderr, EXIT_FAILURE);
@@ -708,6 +749,21 @@ _("%s: More than one -L option specified\n"),
case 'v':
noise = true;
break;
+ case 'r':
+ if (timerange_given) {
+ fprintf(stderr,
+_("%s: More than one -r option specified\n"),
+ progname);
+ return EXIT_FAILURE;
+ }
+ if (! timerange_option(optarg)) {
+ fprintf(stderr,
+_("%s: invalid time range: %s\n"),
+ progname, optarg);
+ return EXIT_FAILURE;
+ }
+ timerange_given = true;
+ break;
case 's':
warning(_("-s ignored"));
break;
@@ -961,11 +1017,6 @@ dolink(char const *fromfield, char const *tofield, bool staysymlink)
}
}
-#define TIME_T_BITS_IN_FILE 64
-
-static zic_t const min_time = MINVAL(zic_t, TIME_T_BITS_IN_FILE);
-static zic_t const max_time = MAXVAL(zic_t, TIME_T_BITS_IN_FILE);
-
/* Return true if NAME is a directory. */
static bool
itsdir(char const *name)
@@ -1714,12 +1765,16 @@ puttzcode(const int_fast32_t val, FILE *const fp)
}
static void
-puttzcode64(const zic_t val, FILE *const fp)
+puttzcodepass(zic_t val, FILE *fp, int pass)
{
+ if (pass == 1)
+ puttzcode(val, fp);
+ else {
char buf[8];
convert64(val, buf);
fwrite(buf, sizeof buf, 1, fp);
+ }
}
static int
@@ -1742,14 +1797,42 @@ swaptypes(int i, int j)
{ bool t = ttisgmts[i]; ttisgmts[i] = ttisgmts[j]; ttisgmts[j] = t; }
}
+struct timerange {
+ int defaulttype;
+ ptrdiff_t base, count;
+ int leapbase, leapcount;
+};
+
+static struct timerange
+limitrange(struct timerange r, zic_t lo, zic_t hi,
+ zic_t const *ats, unsigned char const *types)
+{
+ while (0 < r.count && ats[r.base] < lo) {
+ r.defaulttype = types[r.base];
+ r.count--;
+ r.base++;
+ }
+ while (0 < r.leapcount && trans[r.leapbase] < lo) {
+ r.leapcount--;
+ r.leapbase++;
+ }
+
+ if (hi < ZIC_MAX) {
+ while (0 < r.count && hi + 1 < ats[r.base + r.count - 1])
+ r.count--;
+ while (0 < r.leapcount && hi + 1 < trans[r.leapbase + r.leapcount - 1])
+ r.leapcount--;
+ }
+
+ return r;
+}
+
static void
writezone(const char *const name, const char *const string, char version,
int defaulttype)
{
register FILE * fp;
register ptrdiff_t i, j;
- register int leapcnt32, leapi32;
- register ptrdiff_t timecnt32, timei32;
register int pass;
static const struct tzhead tzh0;
static struct tzhead tzh;
@@ -1764,6 +1847,7 @@ writezone(const char *const name, const char *const string, char version,
_Alignof(zic_t)));
void *typesptr = ats + nats;
unsigned char *types = typesptr;
+ struct timerange rangeall, range32, range64;
/*
** Sort.
@@ -1839,32 +1923,13 @@ writezone(const char *const name, const char *const string, char version,
timecnt++;
}
- /*
- ** Figure out 32-bit-limited starts and counts.
- */
- timecnt32 = timecnt;
- timei32 = 0;
- leapcnt32 = leapcnt;
- leapi32 = 0;
- while (0 < timecnt32 && INT32_MAX < ats[timecnt32 - 1])
- --timecnt32;
- while (1 < timecnt32 && ats[timei32] < INT32_MIN
- && ats[timei32 + 1] <= INT32_MIN) {
- /* Discard too-low transitions, except keep any last too-low
- transition if no transition is exactly at INT32_MIN.
- The kept transition will be output as an INT32_MIN
- "transition" appropriate for buggy 32-bit clients that do
- not use time type 0 for timestamps before the first
- transition; see below. */
- --timecnt32;
- ++timei32;
- }
- while (0 < leapcnt32 && INT32_MAX < trans[leapcnt32 - 1])
- --leapcnt32;
- while (0 < leapcnt32 && trans[leapi32] < INT32_MIN) {
- --leapcnt32;
- ++leapi32;
- }
+ rangeall.defaulttype = defaulttype;
+ rangeall.base = rangeall.leapbase = 0;
+ rangeall.count = timecnt;
+ rangeall.leapcount = leapcnt;
+ range64 = limitrange(rangeall, lo_time, hi_time, ats, types);
+ range32 = limitrange(range64, INT32_MIN, INT32_MAX, ats, types);
+
/*
** Remove old file, if any, to snap links.
*/
@@ -1894,6 +1959,9 @@ writezone(const char *const name, const char *const string, char version,
for (pass = 1; pass <= 2; ++pass) {
register ptrdiff_t thistimei, thistimecnt, thistimelim;
register int thisleapi, thisleapcnt, thisleaplim;
+ int currenttype, thisdefaulttype;
+ bool locut, hicut;
+ zic_t lo;
int old0;
char omittype[TZ_MAX_TYPES];
int typemap[TZ_MAX_TYPES];
@@ -1904,33 +1972,72 @@ writezone(const char *const name, const char *const string, char version,
int indmap[TZ_MAX_CHARS];
if (pass == 1) {
- thistimei = timei32;
- thistimecnt = timecnt32;
+ /* Arguably the default time type in the 32-bit data
+ should be range32.defaulttype, which is suited for
+ timestamps just before INT32_MIN. However, zic
+ traditionally used the time type of the indefinite
+ past instead. Internet RFC 8532 says readers should
+ ignore 32-bit data, so this discrepancy matters only
+ to obsolete readers where the traditional type might
+ be more appropriate even if it's "wrong". So, use
+ the historical zic value, unless -r specifies a low
+ cutoff that excludes some 32-bit timestamps. */
+ thisdefaulttype = (lo_time <= INT32_MIN
+ ? range64.defaulttype
+ : range32.defaulttype);
+
+ thistimei = range32.base;
+ thistimecnt = range32.count;
toomanytimes = thistimecnt >> 31 >> 1 != 0;
- thisleapi = leapi32;
- thisleapcnt = leapcnt32;
+ thisleapi = range32.leapbase;
+ thisleapcnt = range32.leapcount;
+ locut = INT32_MIN < lo_time;
+ hicut = hi_time < INT32_MAX;
} else {
- thistimei = 0;
- thistimecnt = timecnt;
+ thisdefaulttype = range64.defaulttype;
+ thistimei = range64.base;
+ thistimecnt = range64.count;
toomanytimes = thistimecnt >> 31 >> 31 >> 2 != 0;
- thisleapi = 0;
- thisleapcnt = leapcnt;
+ thisleapi = range64.leapbase;
+ thisleapcnt = range64.leapcount;
+ locut = min_time < lo_time;
+ hicut = hi_time < max_time;
}
if (toomanytimes)
error(_("too many transition times"));
+
+ /* Keep the last too-low transition if no transition is
+ exactly at LO. The kept transition will be output as
+ a LO "transition"; see "Output a LO_TIME transition"
+ below. This is needed when the output is truncated at
+ the start, and is also useful when catering to buggy
+ 32-bit clients that do not use time type 0 for
+ timestamps before the first transition. */
+ if (0 < thistimei && ats[thistimei] != lo_time) {
+ thistimei--;
+ thistimecnt++;
+ locut = false;
+ }
+
thistimelim = thistimei + thistimecnt;
thisleaplim = thisleapi + thisleapcnt;
+ if (thistimecnt != 0) {
+ if (ats[thistimei] == lo_time)
+ locut = false;
+ if (hi_time < ZIC_MAX && ats[thistimelim - 1] == hi_time + 1)
+ hicut = false;
+ }
memset(omittype, true, typecnt);
- omittype[defaulttype] = false;
+ omittype[thisdefaulttype] = false;
for (i = thistimei; i < thistimelim; i++)
omittype[types[i]] = false;
- /* Reorder types to make DEFAULTTYPE type 0.
- Use TYPEMAP to swap OLD0 and DEFAULTTYPE so that
- DEFAULTTYPE appears as type 0 in the output instead
+ /* Reorder types to make THISDEFAULTTYPE type 0.
+ Use TYPEMAP to swap OLD0 and THISDEFAULTTYPE so that
+ THISDEFAULTTYPE appears as type 0 in the output instead
of OLD0. TYPEMAP also omits unused types. */
old0 = strlen(omittype);
- swaptypes(old0, defaulttype);
+ swaptypes(old0, thisdefaulttype);
#ifndef LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
/*
@@ -1982,8 +2089,8 @@ writezone(const char *const name, const char *const string, char version,
thistypecnt = 0;
for (i = old0; i < typecnt; i++)
if (!omittype[i])
- typemap[i == old0 ? defaulttype
- : i == defaulttype ? old0 : i]
+ typemap[i == old0 ? thisdefaulttype
+ : i == thisdefaulttype ? old0 : i]
= thistypecnt++;
for (i = 0; i < sizeof indmap / sizeof indmap[0]; ++i)
@@ -2013,7 +2120,7 @@ writezone(const char *const name, const char *const string, char version,
convert(thistypecnt, tzh.tzh_ttisgmtcnt);
convert(thistypecnt, tzh.tzh_ttisstdcnt);
convert(thisleapcnt, tzh.tzh_leapcnt);
- convert(thistimecnt, tzh.tzh_timecnt);
+ convert(locut + thistimecnt + hicut, tzh.tzh_timecnt);
convert(thistypecnt, tzh.tzh_typecnt);
convert(thischarcnt, tzh.tzh_charcnt);
DO(tzh_magic);
@@ -2026,21 +2133,29 @@ writezone(const char *const name, const char *const string, char version,
DO(tzh_typecnt);
DO(tzh_charcnt);
#undef DO
- for (i = thistimei; i < thistimelim; ++i)
- if (pass == 1)
- /*
- ** Output an INT32_MIN "transition"
- ** if appropriate; see above.
- */
- puttzcode(((ats[i] < INT32_MIN) ?
- INT32_MIN : ats[i]), fp);
- else puttzcode64(ats[i], fp);
- for (i = thistimei; i < thistimelim; ++i) {
- unsigned char uc;
+ /* Output a LO_TIME transition if needed; see limitrange.
+ But do not go below the minimum representable value
+ for this pass. */
+ lo = pass == 1 && lo_time < INT32_MIN ? INT32_MIN : lo_time;
- uc = typemap[types[i]];
- fwrite(&uc, sizeof uc, 1, fp);
+ if (locut)
+ puttzcodepass(lo, fp, pass);
+ for (i = thistimei; i < thistimelim; ++i) {
+ zic_t at = ats[i] < lo ? lo : ats[i];
+ puttzcodepass(at, fp, pass);
+ }
+ if (hicut)
+ puttzcodepass(hi_time + 1, fp, pass);
+ currenttype = 0;
+ if (locut)
+ putc(currenttype, fp);
+ for (i = thistimei; i < thistimelim; ++i) {
+ currenttype = typemap[types[i]];
+ putc(currenttype, fp);
}
+ if (hicut)
+ putc(currenttype, fp);
+
for (i = old0; i < typecnt; i++)
if (!omittype[i]) {
puttzcode(gmtoffs[i], fp);
@@ -2070,9 +2185,7 @@ writezone(const char *const name, const char *const string, char version,
}
todo = tadd(trans[i], -gmtoffs[j]);
} else todo = trans[i];
- if (pass == 1)
- puttzcode(todo, fp);
- else puttzcode64(todo, fp);
+ puttzcodepass(todo, fp, pass);
puttzcode(corr[i], fp);
}
for (i = old0; i < typecnt; i++)
@@ -2081,7 +2194,7 @@ writezone(const char *const name, const char *const string, char version,
for (i = old0; i < typecnt; i++)
if (!omittype[i])
putc(ttisgmts[i], fp);
- swaptypes(old0, defaulttype);
+ swaptypes(old0, thisdefaulttype);
}
fprintf(fp, "\n%s\n", string);
close_file(fp, directory, name);
@@ -2301,6 +2414,12 @@ stringzone(char *result, struct zone const *zpfirst, ptrdiff_t zonecount)
struct rule stdr, dstr;
result[0] = '\0';
+
+ /* Internet RFC 8536 section 5.1 says to use an empty TZ string if
+ future timestamps are truncated. */
+ if (hi_time < max_time)
+ return -1;
+
zp = zpfirst + zonecount - 1;
stdrp = dstrp = NULL;
for (i = 0; i < zp->z_nrules; ++i) {
@@ -2737,11 +2856,12 @@ error(_("can't determine time zone abbreviation to use just after until time"));
xr.r_dycode = DC_DOM;
xr.r_dayofmonth = 1;
xr.r_tod = 0;
- for (lastat = &attypes[0], i = 1; i < timecnt; i++)
+ for (lastat = attypes, i = 1; i < timecnt; i++)
if (attypes[i].at > lastat->at)
lastat = &attypes[i];
- if (lastat->at < rpytime(&xr, max_year - 1)) {
- addtt(rpytime(&xr, max_year + 1), lastat->type);
+ if (!lastat || lastat->at < rpytime(&xr, max_year - 1)) {
+ addtt(rpytime(&xr, max_year + 1),
+ lastat ? lastat->type : defaulttype);
attypes[timecnt - 1].dontmerge = true;
}
}