[tz] [PATCH] New file time.tab, superseding zone.tab

Paul Eggert eggert at cs.ucla.edu
Fri Jul 18 20:36:57 UTC 2014


It allows multiple country codes per zone.  Switch code and data to
use the new format, along with the recently-added Crozet Islands entry.
The old zone.tab file is still installed but is deprecated.
The new file uses UTF-8; add commentary saying that iso3166.tab is
planned to change to UTF-8.
* Theory, tzselect.8 (FILES): zone.tab -> time.tab.
* africa (Indian/Alfred_Faure): Remove link.
* antarctica: Mention Possession Island in comments.
* checktab.awk: Add support for checking time.tab.
* iso3166.tab: Mention planned switch to UTF-8.
Update ISO 3166-1 Newsletter from VI-15 to VI-16.
* time.tab: New file.
* tzselect.ksh (zonetabtype): New variable.
Add undocumented -t option, meant for developer testing.
(TZ_ZONE_TABLE): Use zonetabtype.
(output_distances, countries, regions, TZ): Support time.tab format.
(quoted_continents, distance_table, countries, regions)
(TZ, TZ_for_date): Quote shell strings more carefully.
* zone.tab: Refer to time.tab for detailed comments about format.
(Indian/Alfred_Faure): Remove.
* Makefile (TIMETABLES): New macro.
(TABDATA, install, check_tables): Use it.
(check_character_set, check_tables): Check time.tab too.
(check_time_t_alternatives): Use time.tab, not zone.tab.
* NEWS: Document the above.
---
 Makefile     |  20 ++--
 NEWS         |  15 ++-
 Theory       |   4 +-
 africa       |   3 +-
 antarctica   |   2 +-
 checktab.awk |  58 +++++-----
 iso3166.tab  |  12 +-
 time.tab     | 371 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tzselect.8   |   4 +-
 tzselect.ksh |  35 ++++--
 zone.tab     |  37 ++----
 11 files changed, 477 insertions(+), 84 deletions(-)
 create mode 100644 time.tab

diff --git a/Makefile b/Makefile
index 8de640a..68388b3 100644
--- a/Makefile
+++ b/Makefile
@@ -340,7 +340,8 @@ PRIMARY_YDATA=	africa antarctica asia australasia \
 YDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
 NDATA=		systemv factory
 TDATA=		$(YDATA) $(NDATA)
-TABDATA=	iso3166.tab zone.tab leapseconds
+TIMETABLES=	time.tab zone.tab
+TABDATA=	iso3166.tab $(TIMETABLES) leapseconds
 LEAP_DEPS=	leapseconds.awk leap-seconds.list
 DATA=		$(YDATA) $(NDATA) $(TABDATA) \
 			$(LEAP_DEPS) yearistype.sh
@@ -364,7 +365,7 @@ install:	all $(DATA) $(REDO) $(MANS)
 			$(DESTDIR)$(MANDIR)/man8
 		$(ZIC) -y $(YEARISTYPE) \
 			-d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES)
-		cp -f iso3166.tab zone.tab $(DESTDIR)$(TZDIR)/.
+		cp -f iso3166.tab $(TIMETABLES) $(DESTDIR)$(TZDIR)/.
 		cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/.
 		cp libtz.a $(DESTDIR)$(LIBDIR)/.
 		$(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a
@@ -455,13 +456,18 @@ check_character_set: $(ENCHILADA)
 		sharp='#' && \
 		! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
 			$(MISC) $(SOURCES) $(WEB_PAGES) && \
-		! grep -Env $(SAFE_SHARP_LINE) $(DATA) && \
+		! grep -Env $(SAFE_SHARP_LINE) $(YDATA) $(NDATA) iso3166.tab \
+			zone.tab leapseconds $(LEAP_DEPS) yearistype.sh && \
 		test $$(grep -Ecv $(SAFE_SHARP_LINE) Makefile) -eq 1 && \
-		! grep -Env $(NONSYM_LINE) README NEWS Theory $(MANS) date.1 && \
+		! grep -Env $(NONSYM_LINE) README NEWS Theory $(MANS) date.1 \
+			time.tab && \
 		! grep -Env $(VALID_LINE) $(ENCHILADA)
 
-check_tables:	checktab.awk $(PRIMARY_YDATA)
-		$(AWK) -f checktab.awk $(PRIMARY_YDATA)
+check_tables:	checktab.awk $(PRIMARY_YDATA) $(TIMETABLES)
+		for tab in $(TIMETABLES); do \
+		  $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
+		    || exit; \
+		done
 
 check_web:	$(WEB_PAGES)
 		$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES)
@@ -540,7 +546,7 @@ check_public:	$(ENCHILADA)
 # Check that the code works under various alternative
 # implementations of time_t.
 check_time_t_alternatives:
-		zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone.tab` && \
+		zones=`$(AWK) '/^[^#]/ { print $$3 }' <time.tab` && \
 		for type in $(TIME_T_ALTERNATIVES); do \
 		  mkdir -p tzpublic/$$type && \
 		  make clean_misc && \
diff --git a/NEWS b/NEWS
index ffcbd92..babfdac 100644
--- a/NEWS
+++ b/NEWS
@@ -120,11 +120,22 @@ Unreleased, experimental changes
     Europe/Riga.  Also, Moscow's location has been changed to its Kilometer 0
     point.  (Thanks to Vladimir Karpinsky for the Moscow changes.)
 
-  New link name
+  Changes affecting data format
 
-    New link Indian/Alfred_Faure for the Crozet Islands and the
+    A new file 'time.tab' supersedes 'zone.tab' in the installed data.
+    The new file's extended format allows multiple country codes per zone.
+    The older file is still installed but is deprecated; its format is
+    not changing and it will still be distributed for a while, but new
+    applications should use the new file.
+
+    The new file format simplifies maintenance of obscure locations.
+    To test this, it adds coverage for the Crozet Islands and the
     Scattered Islands.  (Thanks to Tobias Conradi and Antoine Leca.)
 
+    The file 'iso3166.tab' is planned to switch from ASCII to UTF-8.
+    It is still ASCII now, but commentary about the switch has been added.
+    The new file 'time.tab' already uses UTF-8.
+
   Changes affecting code
 
     'localtime', 'mktime', etc. now use much less stack space if ALL_STATE
diff --git a/Theory b/Theory
index 05a9f65..591bba3 100644
--- a/Theory
+++ b/Theory
@@ -455,10 +455,10 @@ in decreasing order of importance:
 	If a name is changed, put its old spelling in the 'backward' file.
 		This means old spellings will continue to work.
 
-The file 'zone.tab' lists geographical locations used to name time
+The file 'time.tab' lists geographical locations used to name time
 zone rule files.  It is intended to be an exhaustive list of names
 for geographic regions as described above; this is a subset of the
-names in the data.  Although a 'zone.tab' location's longitude
+names in the data.  Although a 'time.tab' location's longitude
 corresponds to its LMT offset with one hour for every 15 degrees east
 longitude, this relationship is not exact.
 
diff --git a/africa b/africa
index 3eef85f..3a68f88 100644
--- a/africa
+++ b/africa
@@ -978,7 +978,8 @@ Link Africa/Lagos Africa/Porto-Novo  # Benin
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun	# Saint-Denis
 			4:00	-	RET	# Réunion Time
-Link Indian/Reunion Indian/Alfred_Faure
+#
+# Crozet Islands also observes Réunion time; see the 'antarctica' file.
 #
 # Scattered Islands (Îles Éparses) administered from Réunion are as follows.
 # The following information about them is taken from
diff --git a/antarctica b/antarctica
index 9e9d118..912232a 100644
--- a/antarctica
+++ b/antarctica
@@ -162,7 +162,7 @@ Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 #
 # French Southern Territories with year-round inhabitants
 #
-# Alfred Faure, Crozet Islands, -462551+0515152, since 1964;
+# Alfred Faure, Possession Island, Crozet Islands, -462551+0515152, since 1964;
 #	sealing & whaling stations operated variously 1802/1911+;
 #	see Indian/Reunion.
 #
diff --git a/checktab.awk b/checktab.awk
index 25a8d3f..ac40954 100644
--- a/checktab.awk
+++ b/checktab.awk
@@ -6,7 +6,7 @@ BEGIN {
 	FS = "\t"
 
 	if (!iso_table) iso_table = "iso3166.tab"
-	if (!zone_table) zone_table = "zone.tab"
+	if (!zone_table) zone_table = "time.tab"
 	if (!want_warnings) want_warnings = -1
 
 	# A special (and we hope temporary) case.
@@ -51,7 +51,6 @@ BEGIN {
 		cc2NR[cc] = iso_NR
 	}
 
-	zone_table = "zone.tab"
 	cc0 = ""
 
 	while (getline <zone_table) {
@@ -62,7 +61,8 @@ BEGIN {
 				zone_table, zone_NR >>"/dev/stderr"
 			status = 1
 		}
-		cc = $1
+		split($1, cca, /,/)
+		cc = cca[1]
 		coordinates = $2
 		tz = $3
 		comments = $4
@@ -72,17 +72,20 @@ BEGIN {
 			status = 1
 		}
 		cc0 = cc
-		cctz = cc tz
-		cctztab[cctz] = 1
-		tztab[tz] = 1
-		tz2comments[cctz] = comments
-		tz2NR[tz] = zone_NR
-		if (cc2name[cc]) {
+		for (i in cca) {
+		    cc = cca[i]
+		    cctz = cc tz
+		    cctztab[cctz] = 1
+		    tztab[tz] = 1
+		    tz2comments[tz] = comments
+		    tz2NR[tz] = zone_NR
+		    if (cc2name[cc]) {
 			cc_used[cc]++
-		} else {
+		    } else {
 			printf "%s:%d: %s: unknown country code\n", \
 				zone_table, zone_NR, cc >>"/dev/stderr"
 			status = 1
+		    }
 		}
 		if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
 		    && coordinates !~ /^[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$/) {
@@ -95,23 +98,26 @@ BEGIN {
 	for (cctz in cctztab) {
 		cc = substr (cctz, 1, 2)
 		tz = substr (cctz, 3)
-		if (cc_used[cc] == 1) {
-			if (tz2comments[cctz]) {
-				printf "%s:%d: unnecessary comment '%s'\n", \
-					zone_table, tz2NR[tz], \
-					tz2comments[cctz] \
-					>>"/dev/stderr"
-				status = 1
-			}
-		} else {
-			if (!tz2comments[cctz]) {
-				printf "%s:%d: missing comment\n", \
-					zone_table, tz2NR[tz] >>"/dev/stderr"
-				status = 1
-			}
+		if (1 < cc_used[cc]) {
+			comments_needed[tz] = cc
 		}
 	}
-
+	for (cctz in cctztab) {
+	  cc = substr (cctz, 1, 2)
+	  tz = substr (cctz, 3)
+	  if (!comments_needed[tz] && tz2comments[tz]) {
+	    printf "%s:%d: unnecessary comment '%s'\n", \
+		zone_table, tz2NR[tz], tz2comments[tz] \
+		>>"/dev/stderr"
+	    tz2comments[tz] = 0
+	    status = 1
+	  } else if (comments_needed[tz] && !tz2comments[tz]) {
+	    printf "%s:%d: missing comment for %s\n", \
+	      zone_table, tz2NR[tz], comments_needed[tz] \
+	      >>"/dev/stderr"
+	    status = 1
+	  }
+	}
 	FS = " "
 }
 
@@ -122,7 +128,7 @@ $1 ~ /^#/ { next }
 	if ($1 == "Zone") {
 		tz = $2
 		ruleUsed[$4] = 1
-	} else if ($1 == "Link") {
+	} else if ($1 == "Link" && zone_table == "zone.tab") {
 		# Ignore Link commands if source and destination basenames
 		# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
 		src = $2
diff --git a/iso3166.tab b/iso3166.tab
index 38d356d..0b0b842 100644
--- a/iso3166.tab
+++ b/iso3166.tab
@@ -3,21 +3,21 @@
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
-# From Paul Eggert (2013-05-27):
+# From Paul Eggert (2014-07-18):
+# This file contains a table of two-letter country codes.  Columns are
+# separated by a single tab.  Lines beginning with '#' are comments.
+# Although all text currently uses ASCII encoding, this is planned to
+# change to UTF-8 soon.  The columns of the table are as follows:
 #
-# This file contains a table with the following columns:
 # 1.  ISO 3166-1 alpha-2 country code, current as of
-#     ISO 3166-1 Newsletter VI-15 (2013-05-10).  See: Updates on ISO 3166
+#     ISO 3166-1 Newsletter VI-16 (2013-07-11).  See: Updates on ISO 3166
 #   http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
 # 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.
 #
-# Columns are separated by a single tab.
 # The table is sorted by country code.
 #
-# Lines beginning with '#' are comments.
-#
 # This table is intended as an aid for users, to help them select time
 # zone data appropriate for their practical needs.  It is not intended
 # to take or endorse any position on legal or territorial claims.
diff --git a/time.tab b/time.tab
new file mode 100644
index 0000000..74ca92c
--- /dev/null
+++ b/time.tab
@@ -0,0 +1,371 @@
+# tz zone descriptions
+#
+# This file is in the public domain.
+#
+# From Paul Eggert (2014-07-18):
+# This file contains a table where each row stands for a zone where
+# civil time stamps have agreed since 1970.  Columns are separated by
+# a single tab.  Lines beginning with '#' are comments.  All text uses
+# UTF-8 encoding.  The columns of the table are as follows:
+#
+# 1.  The countries that overlap the zone, as a comma-separated list
+#     of ISO 3166 2-character country codes.  See the file 'iso3166.tab'.
+# 2.  Latitude and longitude of the zone's principal location
+#     in ISO 6709 sign-degrees-minutes-seconds format,
+#     either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
+#     first latitude (+ is north), then longitude (+ is east).
+# 3.  Zone name used in value of TZ environment variable.
+#     Please see the 'Theory' file for how zone names are chosen.
+#     If multiple zones overlap a country, each has a row in the
+#     table, with each column 1 containing the country code.
+# 4.  Comments; present if and only if a country has multiple zones.
+#
+# If a zone covers multiple countries, the most-populous city is used,
+# and that country is listed first in column 1; any other countries
+# are listed alphabetically by country code.  The table is sorted
+# first by country code, then (if possible) by an order within the
+# country that (1) makes some geographical sense, and (2) puts the
+# most populous zones first, where that does not contradict (1).
+#
+# This table is intended as an aid for users, to help them select time
+# zone data appropriate for their practical needs.  It is not intended
+# to take or endorse any position on legal or territorial claims.
+#
+#country-
+#codes	coordinates	TZ	comments
+AD	+4230+00131	Europe/Andorra
+AE,OM	+2518+05518	Asia/Dubai
+AF	+3431+06912	Asia/Kabul
+AL	+4120+01950	Europe/Tirane
+AM	+4011+04430	Asia/Yerevan
+AQ	-6734-06808	Antarctica/Rothera	Rothera Station, Adelaide Island
+AQ	-6448-06406	Antarctica/Palmer	Palmer Station, Anvers Island
+AQ	-6736+06253	Antarctica/Mawson	Mawson Station, Holme Bay
+AQ	-6835+07758	Antarctica/Davis	Davis Station, Vestfold Hills
+AQ	-6617+11031	Antarctica/Casey	Casey Station, Bailey Peninsula
+AQ	-7824+10654	Antarctica/Vostok	Vostok Station, Lake Vostok
+AQ	-6640+14001	Antarctica/DumontDUrville	Dumont-d'Urville Station, Terre Adelie
+AQ	-690022+0393524	Antarctica/Syowa	Syowa Station, E Ongul I
+AQ	-720041+0023206	Antarctica/Troll	Troll Station, Queen Maud Land
+AR	-3436-05827	America/Argentina/Buenos_Aires	Buenos Aires (BA, CF)
+AR	-3124-06411	America/Argentina/Cordoba	most locations (CB, CC, CN, ER, FM, MN, SE, SF)
+AR	-2447-06525	America/Argentina/Salta	(SA, LP, NQ, RN)
+AR	-2411-06518	America/Argentina/Jujuy	Jujuy (JY)
+AR	-2649-06513	America/Argentina/Tucuman	Tucumán (TM)
+AR	-2828-06547	America/Argentina/Catamarca	Catamarca (CT), Chubut (CH)
+AR	-2926-06651	America/Argentina/La_Rioja	La Rioja (LR)
+AR	-3132-06831	America/Argentina/San_Juan	San Juan (SJ)
+AR	-3253-06849	America/Argentina/Mendoza	Mendoza (MZ)
+AR	-3319-06621	America/Argentina/San_Luis	San Luis (SL)
+AR	-5138-06913	America/Argentina/Rio_Gallegos	Santa Cruz (SC)
+AR	-5448-06818	America/Argentina/Ushuaia	Tierra del Fuego (TF)
+AS,UM	-1416-17042	Pacific/Pago_Pago	Samoa, Midway
+AT	+4813+01620	Europe/Vienna
+AU	-3133+15905	Australia/Lord_Howe	Lord Howe Island
+AU	-5430+15857	Antarctica/Macquarie	Macquarie Island
+AU	-4253+14719	Australia/Hobart	Tasmania - most locations
+AU	-3956+14352	Australia/Currie	Tasmania - King Island
+AU	-3749+14458	Australia/Melbourne	Victoria
+AU	-3352+15113	Australia/Sydney	New South Wales - most locations
+AU	-3157+14127	Australia/Broken_Hill	New South Wales - Yancowinna
+AU	-2728+15302	Australia/Brisbane	Queensland - most locations
+AU	-2016+14900	Australia/Lindeman	Queensland - Holiday Islands
+AU	-3455+13835	Australia/Adelaide	South Australia
+AU	-1228+13050	Australia/Darwin	Northern Territory
+AU	-3157+11551	Australia/Perth	Western Australia - most locations
+AU	-3143+12852	Australia/Eucla	Western Australia - Eucla area
+AZ	+4023+04951	Asia/Baku
+BB	+1306-05937	America/Barbados
+BD	+2343+09025	Asia/Dhaka
+BE	+5050+00420	Europe/Brussels
+BG	+4241+02319	Europe/Sofia
+BM	+3217-06446	Atlantic/Bermuda
+BN	+0456+11455	Asia/Brunei
+BO	-1630-06809	America/La_Paz
+BR	-0351-03225	America/Noronha	Atlantic islands
+BR	-0127-04829	America/Belem	Amapá, E Pará
+BR	-0343-03830	America/Fortaleza	NE Brazil (MA, PI, CE, RN, PB)
+BR	-0803-03454	America/Recife	Pernambuco
+BR	-0712-04812	America/Araguaina	Tocantins
+BR	-0940-03543	America/Maceio	Alagoas, Sergipe
+BR	-1259-03831	America/Bahia	Bahia
+BR	-2332-04637	America/Sao_Paulo	S & SE Brazil (GO, DF, MG, ES, RJ, SP, PR, SC, RS)
+BR	-2027-05437	America/Campo_Grande	Mato Grosso do Sul
+BR	-1535-05605	America/Cuiaba	Mato Grosso
+BR	-0226-05452	America/Santarem	W Pará
+BR	-0846-06354	America/Porto_Velho	Rondônia
+BR	+0249-06040	America/Boa_Vista	Roraima
+BR	-0308-06001	America/Manaus	E Amazonas
+BR	-0640-06952	America/Eirunepe	W Amazonas
+BR	-0958-06748	America/Rio_Branco	Acre
+BS	+2505-07721	America/Nassau
+BT	+2728+08939	Asia/Thimphu
+BY	+5354+02734	Europe/Minsk
+BZ	+1730-08812	America/Belize
+CA	+4734-05243	America/St_Johns	Newfoundland Time, including SE Labrador
+CA	+4439-06336	America/Halifax	Atlantic Time - Nova Scotia (most places), PEI
+CA	+4612-05957	America/Glace_Bay	Atlantic Time - Nova Scotia - places that did not observe DST 1966-1971
+CA	+4606-06447	America/Moncton	Atlantic Time - New Brunswick
+CA	+5320-06025	America/Goose_Bay	Atlantic Time - Labrador - most locations
+CA	+5125-05707	America/Blanc-Sablon	Atlantic Standard Time - Quebec - Lower North Shore
+CA	+4339-07923	America/Toronto	Eastern Time - Ontario & Quebec - most locations
+CA	+4901-08816	America/Nipigon	Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
+CA	+4823-08915	America/Thunder_Bay	Eastern Time - Thunder Bay, Ontario
+CA	+6344-06828	America/Iqaluit	Eastern Time - east Nunavut - most locations
+CA	+6608-06544	America/Pangnirtung	Eastern Time - Pangnirtung, Nunavut
+CA	+744144-0944945	America/Resolute	Central Time - Resolute, Nunavut
+CA	+484531-0913718	America/Atikokan	Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
+CA	+624900-0920459	America/Rankin_Inlet	Central Time - central Nunavut
+CA	+4953-09709	America/Winnipeg	Central Time - Manitoba & west Ontario
+CA	+4843-09434	America/Rainy_River	Central Time - Rainy River & Fort Frances, Ontario
+CA	+5024-10439	America/Regina	Central Standard Time - Saskatchewan - most locations
+CA	+5017-10750	America/Swift_Current	Central Standard Time - Saskatchewan - midwest
+CA	+5333-11328	America/Edmonton	Mountain Time - Alberta, east British Columbia & west Saskatchewan
+CA	+690650-1050310	America/Cambridge_Bay	Mountain Time - west Nunavut
+CA	+6227-11421	America/Yellowknife	Mountain Time - central Northwest Territories
+CA	+682059-1334300	America/Inuvik	Mountain Time - west Northwest Territories
+CA	+4906-11631	America/Creston	Mountain Standard Time - Creston, British Columbia
+CA	+5946-12014	America/Dawson_Creek	Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
+CA	+4916-12307	America/Vancouver	Pacific Time - west British Columbia
+CA	+6043-13503	America/Whitehorse	Pacific Time - south Yukon
+CA	+6404-13925	America/Dawson	Pacific Time - north Yukon
+CC	-1210+09655	Indian/Cocos
+CH,DE,LI	+4723+00832	Europe/Zurich	Swiss time
+CI,BF,GM,GN,ML,MR,SH,SL,SN,ST,TG	+0519-00402	Africa/Abidjan
+CK	-2114-15946	Pacific/Rarotonga
+CL	-3327-07040	America/Santiago	most locations
+CL	-2709-10926	Pacific/Easter	Easter Island
+CN	+3114+12128	Asia/Shanghai	Beijing Time
+CN	+4348+08735	Asia/Urumqi	Xinjiang Time
+CO	+0436-07405	America/Bogota
+CR	+0956-08405	America/Costa_Rica
+CU	+2308-08222	America/Havana
+CV	+1455-02331	Atlantic/Cape_Verde
+CW,AW,BQ,SX	+1211-06900	America/Curacao
+CX	-1025+10543	Indian/Christmas
+CY	+3510+03322	Asia/Nicosia
+CZ,SK	+5005+01426	Europe/Prague
+DE	+5230+01322	Europe/Berlin	Berlin time
+DK	+5540+01235	Europe/Copenhagen
+DO	+1828-06954	America/Santo_Domingo
+DZ	+3647+00303	Africa/Algiers
+EC	-0210-07950	America/Guayaquil	mainland
+EC	-0054-08936	Pacific/Galapagos	Galápagos Islands
+EE	+5925+02445	Europe/Tallinn
+EG	+3003+03115	Africa/Cairo
+EH	+2709-01312	Africa/El_Aaiun
+ES	+4024-00341	Europe/Madrid	mainland
+ES	+3553-00519	Africa/Ceuta	Ceuta & Melilla
+ES	+2806-01524	Atlantic/Canary	Canary Islands
+FI,AX	+6010+02458	Europe/Helsinki
+FJ	-1808+17825	Pacific/Fiji
+FK	-5142-05751	Atlantic/Stanley
+FM	+0725+15147	Pacific/Chuuk	Chuuk (Truk) and Yap
+FM	+0658+15813	Pacific/Pohnpei	Pohnpei (Ponape)
+FM	+0519+16259	Pacific/Kosrae	Kosrae
+FO	+6201-00646	Atlantic/Faroe
+FR	+4852+00220	Europe/Paris
+GB,GG,IM,JE	+513030-0000731	Europe/London
+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	most locations
+GL	+7646-01840	America/Danmarkshavn	east coast, north of Scoresbysund
+GL	+7029-02158	America/Scoresbysund	Scoresbysund / Ittoqqortoormiit
+GL	+7634-06847	America/Thule	Thule / Pituffik
+GR	+3758+02343	Europe/Athens
+GS	-5416-03632	Atlantic/South_Georgia
+GT	+1438-09031	America/Guatemala
+GU,MP	+1328+14445	Pacific/Guam
+GW	+1151-01535	Africa/Bissau
+GY	+0648-05810	America/Guyana
+HK	+2217+11409	Asia/Hong_Kong
+HN	+1406-08713	America/Tegucigalpa
+HT	+1832-07220	America/Port-au-Prince
+HU	+4730+01905	Europe/Budapest
+ID	-0610+10648	Asia/Jakarta	Java & Sumatra
+ID	-0002+10920	Asia/Pontianak	west & central Borneo
+ID	-0507+11924	Asia/Makassar	east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
+ID	-0232+14042	Asia/Jayapura	west New Guinea (Irian Jaya) & Malukus (Moluccas)
+IE	+5320-00615	Europe/Dublin
+IL	+314650+0351326	Asia/Jerusalem
+IN	+2232+08822	Asia/Kolkata
+IO	-0720+07225	Indian/Chagos
+IQ	+3321+04425	Asia/Baghdad
+IR	+3540+05126	Asia/Tehran
+IS	+6409-02151	Atlantic/Reykjavik
+IT,SM,VA	+4154+01229	Europe/Rome
+JM	+175805-0764736	America/Jamaica
+JO	+3157+03556	Asia/Amman
+JP	+353916+1394441	Asia/Tokyo
+KE,DJ,ER,ET,KM,MG,SO,TZ,UG,YT	-0117+03649	Africa/Nairobi
+KG	+4254+07436	Asia/Bishkek
+KI	+0125+17300	Pacific/Tarawa	Gilbert Islands
+KI	-0308-17105	Pacific/Enderbury	Phoenix Islands
+KI	+0152-15720	Pacific/Kiritimati	Line Islands
+KP	+3901+12545	Asia/Pyongyang
+KR	+3733+12658	Asia/Seoul
+KZ	+4315+07657	Asia/Almaty	most locations
+KZ	+4448+06528	Asia/Qyzylorda	Qyzylorda (Kyzylorda, Kzyl-Orda)
+KZ	+5017+05710	Asia/Aqtobe	Aqtobe (Aktobe)
+KZ	+4431+05016	Asia/Aqtau	Atyrau (Atirau, Gur'yev), Mangghystau (Mankistau)
+KZ	+5113+05121	Asia/Oral	West Kazakhstan
+LB	+3353+03530	Asia/Beirut
+LK	+0656+07951	Asia/Colombo
+LR	+0618-01047	Africa/Monrovia
+LT	+5441+02519	Europe/Vilnius
+LU	+4936+00609	Europe/Luxembourg
+LV	+5657+02406	Europe/Riga
+LY	+3254+01311	Africa/Tripoli
+MA	+3339-00735	Africa/Casablanca
+MC	+4342+00723	Europe/Monaco
+MD	+4700+02850	Europe/Chisinau
+MH	+0709+17112	Pacific/Majuro	most locations
+MH	+0905+16720	Pacific/Kwajalein	Kwajalein
+MM	+1647+09610	Asia/Rangoon
+MN	+4755+10653	Asia/Ulaanbaatar	most locations
+MN	+4801+09139	Asia/Hovd	Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan
+MN	+4804+11430	Asia/Choibalsan	Dornod, Sükhbaatar
+MO	+2214+11335	Asia/Macau
+MQ	+1436-06105	America/Martinique
+MT	+3554+01431	Europe/Malta
+MU	-2010+05730	Indian/Mauritius
+MV	+0410+07330	Indian/Maldives
+MX	+1924-09909	America/Mexico_City	Central Time - most locations
+MX	+2105-08646	America/Cancun	Central Time - Quintana Roo
+MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatán
+MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo León, Tamaulipas away from US border
+MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo León, Tamaulipas near US border
+MX	+2313-10625	America/Mazatlan	Mountain Time - S Baja, Nayarit, Sinaloa
+MX	+2838-10605	America/Chihuahua	Mexican Mountain Time - Chihuahua away from US border
+MX	+2934-10425	America/Ojinaga	US Mountain Time - Chihuahua near US border
+MX	+2904-11058	America/Hermosillo	Mountain Standard Time - Sonora
+MX	+3232-11701	America/Tijuana	US Pacific Time - Baja California near US border
+MX	+3018-11452	America/Santa_Isabel	Mexican Pacific Time - Baja California away from US border
+MX	+2048-10515	America/Bahia_Banderas	Mexican Central Time - Bahía de Banderas
+MY	+0310+10142	Asia/Kuala_Lumpur	peninsular Malaysia
+MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
+MZ,BI,BW,CD,MW,RW,ZM,ZW	-2558+03235	Africa/Maputo	Central Africa Time (UTC+2)
+NA	-2234+01706	Africa/Windhoek
+NC	-2216+16627	Pacific/Noumea
+NF	-2903+16758	Pacific/Norfolk
+NG,AO,BJ,CD,CF,CG,CM,GA,GQ,NE	+0627+00324	Africa/Lagos	West Africa Time (UTC+1)
+NI	+1209-08617	America/Managua
+NL	+5222+00454	Europe/Amsterdam
+NO,SJ	+5955+01045	Europe/Oslo
+NP	+2743+08519	Asia/Kathmandu
+NR	-0031+16655	Pacific/Nauru
+NU	-1901-16955	Pacific/Niue
+NZ,AQ	-3652+17446	Pacific/Auckland	New Zealand time
+NZ	-4357-17633	Pacific/Chatham	Chatham Islands
+PA,KY	+0858-07932	America/Panama
+PE	-1203-07703	America/Lima
+PF	-1732-14934	Pacific/Tahiti	Society Islands
+PF	-0900-13930	Pacific/Marquesas	Marquesas Islands
+PF	-2308-13457	Pacific/Gambier	Gambier Islands
+PG	-0930+14710	Pacific/Port_Moresby
+PH	+1435+12100	Asia/Manila
+PK	+2452+06703	Asia/Karachi
+PL	+5215+02100	Europe/Warsaw
+PM	+4703-05620	America/Miquelon
+PN	-2504-13005	Pacific/Pitcairn
+PR	+182806-0660622	America/Puerto_Rico
+PS	+3130+03428	Asia/Gaza	Gaza Strip
+PS	+313200+0350542	Asia/Hebron	West Bank
+PT	+3843-00908	Europe/Lisbon	mainland
+PT	+3238-01654	Atlantic/Madeira	Madeira Islands
+PT	+3744-02540	Atlantic/Azores	Azores
+PW	+0720+13429	Pacific/Palau
+PY	-2516-05740	America/Asuncion
+QA,BH	+2517+05132	Asia/Qatar
+RE,TF	-2052+05528	Indian/Reunion	Réunion, Crozet Is, Scattered Is
+RO	+4426+02606	Europe/Bucharest
+RS,BA,HR,ME,MK,SI	+4450+02030	Europe/Belgrade
+RU	+5443+02030	Europe/Kaliningrad	Moscow-01 - Kaliningrad
+RU	+554521+0373704	Europe/Moscow	Moscow+00 - west Russia
+RU	+4457+03406	Europe/Simferopol	Moscow+00 - Crimea
+RU	+4844+04425	Europe/Volgograd	Moscow+00 - Caspian Sea
+RU	+5312+05009	Europe/Samara	Moscow+00 (Moscow+01 after 2014-10-26) - Samara, Udmurtia
+RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
+RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
+RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk
+RU	+5345+08707	Asia/Novokuznetsk	Moscow+03 (Moscow+04 after 2014-10-26) - Kemerovo
+RU	+5601+09250	Asia/Krasnoyarsk	Moscow+04 - Yenisei River
+RU	+5216+10420	Asia/Irkutsk	Moscow+05 - Lake Baikal
+# Add this once the 2014-10-26 Russian change becomes official:
+#RU	+5203+11328	Asia/Chita	Moscow+06 (Moscow+05 after 2014-10-26) - Zabaykalsky
+RU	+6200+12940	Asia/Yakutsk	Moscow+06 - Lena River
+RU	+623923+1353314	Asia/Khandyga	Moscow+06 - Tomponsky, Ust-Maysky
+RU	+4310+13156	Asia/Vladivostok	Moscow+07 - Amur River
+RU	+4658+14242	Asia/Sakhalin	Moscow+07 - Sakhalin Island
+RU	+643337+1431336	Asia/Ust-Nera	Moscow+07 - Oymyakonsky
+RU	+5934+15048	Asia/Magadan	Moscow+08 (Moscow+07 after 2014-10-26) - Magadan
+# Add this once the 2014-10-26 Russian change becomes official:
+#RU	+6728+15343	Asia/Srednekolymsk	Moscow+08 - E Sakha, N Kuril Is
+RU	+5301+15839	Asia/Kamchatka	Moscow+08 (Moscow+09 after 2014-10-26) - Kamchatka
+RU	+6445+17729	Asia/Anadyr	Moscow+08 (Moscow+09 after 2014-10-26) - Bering Sea
+SA,KW,YE	+2438+04643	Asia/Riyadh
+SB	-0932+16012	Pacific/Guadalcanal
+SC	-0440+05528	Indian/Mahe
+SD,SS	+1536+03232	Africa/Khartoum
+SE	+5920+01803	Europe/Stockholm
+SG	+0117+10351	Asia/Singapore
+SR	+0550-05510	America/Paramaribo
+SV	+1342-08912	America/El_Salvador
+SY	+3330+03618	Asia/Damascus
+TC	+2128-07108	America/Grand_Turk
+TD	+1207+01503	Africa/Ndjamena
+TF	-492110+0701303	Indian/Kerguelen	Kerguelen, St Paul I, Amsterdam I
+TH,KH,LA,VN	+1345+10031	Asia/Bangkok
+TJ	+3835+06848	Asia/Dushanbe
+TK	-0922-17114	Pacific/Fakaofo
+TL	-0833+12535	Asia/Dili
+TM	+3757+05823	Asia/Ashgabat
+TN	+3648+01011	Africa/Tunis
+TO	-2110-17510	Pacific/Tongatapu
+TR	+4101+02858	Europe/Istanbul
+TT,AG,AI,BL,DM,GD,GP,MF,LC,KN,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	most locations
+UA	+4837+02218	Europe/Uzhgorod	Ruthenia
+UA	+4750+03510	Europe/Zaporozhye	Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk
+UM	+1917+16637	Pacific/Wake	Wake Island
+US	+404251-0740023	America/New_York	Eastern Time
+US	+421953-0830245	America/Detroit	Eastern Time - Michigan - most locations
+US	+381515-0854534	America/Kentucky/Louisville	Eastern Time - Kentucky - Louisville area
+US	+364947-0845057	America/Kentucky/Monticello	Eastern Time - Kentucky - Wayne County
+US	+394606-0860929	America/Indiana/Indianapolis	Eastern Time - Indiana - most locations
+US	+384038-0873143	America/Indiana/Vincennes	Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
+US	+410305-0863611	America/Indiana/Winamac	Eastern Time - Indiana - Pulaski County
+US	+382232-0862041	America/Indiana/Marengo	Eastern Time - Indiana - Crawford County
+US	+382931-0871643	America/Indiana/Petersburg	Eastern Time - Indiana - Pike County
+US	+384452-0850402	America/Indiana/Vevay	Eastern Time - Indiana - Switzerland County
+US	+415100-0873900	America/Chicago	Central Time
+US	+375711-0864541	America/Indiana/Tell_City	Central Time - Indiana - Perry County
+US	+411745-0863730	America/Indiana/Knox	Central Time - Indiana - Starke County
+US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
+US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County
+US	+465042-1012439	America/North_Dakota/New_Salem	Central Time - North Dakota - Morton County (except Mandan area)
+US	+471551-1014640	America/North_Dakota/Beulah	Central Time - North Dakota - Mercer County
+US	+394421-1045903	America/Denver	Mountain Time
+US	+433649-1161209	America/Boise	Mountain Time - south Idaho & east Oregon
+US	+332654-1120424	America/Phoenix	Mountain Standard Time - Arizona (except Navajo)
+US	+340308-1181434	America/Los_Angeles	Pacific Time
+US	+550737-1313435	America/Metlakatla	Pacific Standard Time - Annette Island, Alaska
+US	+611305-1495401	America/Anchorage	Alaska Time
+US	+581807-1342511	America/Juneau	Alaska Time - Alaska panhandle
+US	+571035-1351807	America/Sitka	Alaska Time - southeast Alaska panhandle
+US	+593249-1394338	America/Yakutat	Alaska Time - Alaska panhandle neck
+US	+643004-1652423	America/Nome	Alaska Time - west Alaska
+US	+515248-1763929	America/Adak	Aleutian Islands
+US,UM	+211825-1575130	Pacific/Honolulu	Hawaii time
+UY	-3453-05611	America/Montevideo
+UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
+UZ	+4120+06918	Asia/Tashkent	east Uzbekistan
+VE	+1030-06656	America/Caracas
+VU	-1740+16825	Pacific/Efate
+WF	-1318-17610	Pacific/Wallis
+WS	-1350-17144	Pacific/Apia
+ZA,LS,SZ	-2615+02800	Africa/Johannesburg
diff --git a/tzselect.8 b/tzselect.8
index 7644112..30375a5 100644
--- a/tzselect.8
+++ b/tzselect.8
@@ -99,8 +99,8 @@ Name of the directory containing time zone data files (default:
 \f2TZDIR\fP\f3/iso3166.tab\fP
 Table of ISO 3166 2-letter country codes and country names.
 .TP
-\f2TZDIR\fP\f3/zone.tab\fP
-Tables of country codes, latitude and longitude, zone names, and
+\f2TZDIR\fP\f3/time.tab\fP
+Table of country codes, latitude and longitude, zone names, and
 descriptive comments.
 .TP
 \f2TZDIR\fP\f3/\fP\f2TZ\fP
diff --git a/tzselect.ksh b/tzselect.ksh
index 963001a..e799a1a 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -46,6 +46,7 @@ REPORT_BUGS_TO=tz at iana.org
 
 coord=
 location_limit=10
+zonetabtype=time
 
 usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT]
 Select a time zone interactively.
@@ -146,6 +147,8 @@ do
 	coord=$OPTARG ;;
     n*)
 	location_limit=$OPTARG ;;
+    t*) # Undocumented option, used for developer testing.
+	zonetabtype=$OPTARG ;;
     -help)
 	exec echo "$usage" ;;
     -version)
@@ -165,10 +168,10 @@ esac
 
 # Make sure the tables are readable.
 TZ_COUNTRY_TABLE=$TZDIR/iso3166.tab
-TZ_ZONE_TABLE=$TZDIR/zone.tab
+TZ_ZONE_TABLE=$TZDIR/$zonetabtype.tab
 for f in $TZ_COUNTRY_TABLE $TZ_ZONE_TABLE
 do
-	<$f || {
+	<"$f" || {
 		echo >&2 "$0: time zone files are not set up correctly"
 		exit 1
 	}
@@ -232,7 +235,13 @@ output_distances='
   /^[^#]/ {
     here_lat = convert_latitude($2)
     here_long = convert_longitude($2)
-    line = $1 "\t" $2 "\t" $3 "\t" country[$1]
+    line = $1 "\t" $2 "\t" $3
+    sep = "\t"
+    ncc = split($1, cc, /,/)
+    for (i = 1; i <= ncc; i++) {
+      line = line sep country[cc[i]]
+      sep = ", "
+    }
     if (NF == 4)
       line = line " - " $4
     printf "%g\t%s\n", dist(coord_lat, coord_long, here_lat, here_long), line
@@ -269,7 +278,7 @@ while
 		entry = entry " Ocean"
               printf "'\''%s'\''\n", entry
             }
-          ' $TZ_ZONE_TABLE |
+          ' <"$TZ_ZONE_TABLE" |
 	  sort -u |
 	  tr '\n' ' '
 	  echo ''
@@ -327,7 +336,7 @@ while
 		    distance_table=`$AWK \
 			    -v coord="$coord" \
 			    -v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
-			    "$output_distances" <$TZ_ZONE_TABLE |
+			    "$output_distances" <"$TZ_ZONE_TABLE" |
 		      sort -n |
 		      sed "${location_limit}q"
 		    `
@@ -355,7 +364,9 @@ while
 			BEGIN { FS = "\t" }
 			/^#/ { next }
 			$3 ~ ("^" continent "/") {
-				if (!cc_seen[$1]++) cc_list[++ccs] = $1
+			    ncc = split($1, cc, /,/)
+			    for (i = 1; i <= ncc; i++)
+				if (!cc_seen[cc[i]]++) cc_list[++ccs] = cc[i]
 			}
 			END {
 				while (getline <TZ_COUNTRY_TABLE) {
@@ -369,7 +380,7 @@ while
 					print country
 				}
 			}
-		' <$TZ_ZONE_TABLE | sort -f`
+		' <"$TZ_ZONE_TABLE" | sort -f`
 
 
 		# If there's more than one country, ask the user which one.
@@ -399,8 +410,8 @@ while
 					}
 				}
 			}
-			$1 == cc { print $4 }
-		' <$TZ_ZONE_TABLE`
+			$1 ~ cc { print $4 }
+		' <"$TZ_ZONE_TABLE"`
 
 
 		# If there's more than one region, ask the user which one.
@@ -430,13 +441,13 @@ while
 					}
 				}
 			}
-			$1 == cc && $4 == region { print $3 }
-		' <$TZ_ZONE_TABLE`
+			$1 ~ cc && $4 == region { print $3 }
+		' <"$TZ_ZONE_TABLE"`
 		esac
 
 		# Make sure the corresponding zoneinfo file exists.
 		TZ_for_date=$TZDIR/$TZ
-		<$TZ_for_date || {
+		<"$TZ_for_date" || {
 			echo >&2 "$0: time zone files are not set up correctly"
 			exit 1
 		}
diff --git a/zone.tab b/zone.tab
index 2ca3cbc..dfc5703 100644
--- a/zone.tab
+++ b/zone.tab
@@ -1,32 +1,20 @@
-# TZ zone descriptions
+# tz zone descriptions (deprecated version)
 #
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 #
-# From Paul Eggert (2013-08-14):
+# From Paul Eggert (2014-07-18):
+# This file is intended as a backward-compatibility aid for older programs.
+# New programs should use time.tab.  This file is like time.tab (see
+# time.tab's comments), but with the following additional restrictions:
 #
-# This file contains a table where each row stands for an area that is
-# the intersection of a region identified by a country code and of a
-# zone where civil clocks have agreed since 1970.  The columns of the
-# table are as follows:
+# 1.  This file contains only ASCII characters.
+# 2.  The first data column contains exactly one country code.
 #
-# 1.  ISO 3166 2-character country code.  See the file 'iso3166.tab'.
-# 2.  Latitude and longitude of the area's principal location
-#     in ISO 6709 sign-degrees-minutes-seconds format,
-#     either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
-#     first latitude (+ is north), then longitude (+ is east).
-# 3.  Zone name used in value of TZ environment variable.
-#     Please see the 'Theory' file for how zone names are chosen.
-#     If multiple zones overlap a country, each has a row in the
-#     table, with column 1 being duplicated.
-# 4.  Comments; present if and only if the country has multiple rows.
-#
-# Columns are separated by a single tab.
-# The table is sorted first by country, then an order within the country that
-# (1) makes some geographical sense, and
-# (2) puts the most populous areas first, where that does not contradict (1).
-#
-# Lines beginning with '#' are comments.
+# Because of (2), each row stands for an area that is the intersection
+# of a region identified by a country code and of a zone where civil
+# clocks have agreed since 1970; this is a narrower definition than
+# that of time.tab.
 #
 # This table is intended as an aid for users, to help them select time
 # zone data appropriate for their practical needs.  It is not intended
@@ -384,8 +372,7 @@ SY	+3330+03618	Asia/Damascus
 SZ	-2618+03106	Africa/Mbabane
 TC	+2128-07108	America/Grand_Turk
 TD	+1207+01503	Africa/Ndjamena
-TF	-492110+0701303	Indian/Kerguelen	Kerguelen, St Paul I, Amsterdam I
-TF	-462551+0515125	Indian/Alfred_Faure	Crozet Is, Scattered Is
+TF	-492110+0701303	Indian/Kerguelen
 TG	+0608+00113	Africa/Lome
 TH	+1345+10031	Asia/Bangkok
 TJ	+3835+06848	Asia/Dushanbe
-- 
1.9.1



More information about the tz mailing list