FW: tztab entries (forwarded with permission)

Paul Eggert eggert at twinsun.com
Tue Aug 12 23:41:34 UTC 1997


   From: 	Dave Kelly[SMTP:dkelly at lhr-sys.DHL.COM]
   Date: 	Monday, August 11, 1997 2:30 PM

   We decided to use the HP-UX timezone name from the tztab file as a
   reference to a timezone since it seemed as good as anything else.
   We have now realised that the entries we have as default in tztab
   are far from complete.

   Do you know where we could get hold of a tztab file which has
   a complete list of entries?

I don't know the HP-UX tztab scheme.  However, I do know the Olson tz
scheme, which is available on most recent Unix hosts (BSD, Linux, SGI,
Sun) and I understand that HP-UX now has (optional?) support for the
Olson tz scheme in /opt/dce/lib/zoneinfo.  The Olson tz scheme is
fairly complete for time zone histories after 1970.

   We do not want to maintain multiple tztab entries for countries
   which use the same zone - i.e.  we want to have a single entry for
   all the countries which use CET/CEST.

Here's what I think you're asking for.  If you're interested only in
times now and in the future, then the Olson database contains too many
names, partly because it goes back to 1970 and thus must track
historical changes, and partly because it insists on at least one name
per country.  You want just one distinct name for each time zone
future, regardless of country.

In that case, what you need is a way to look at the Olson database,
find all the distinct time zone futures in it (starting with 1997, say),
and choose a canonical name for each distinct future.

Choosing the canonical name requires human judgment, but the rest of
this task can be done automatically.  Here's a shell script that does
the automatic part; it assumes the existence of an `md5' command that
prints a checksum, but you can substitute your own checksum command if
you don't have md5.  This script assumes that the only thing that
matters about a time zone is its UTC offset; it ignores the time zone
name (e.g. "EST", "EDT") and whether the time is daylight-saving time.
Also, watch out for a bug in the script: it thinks Asia/Hong_Kong
differs from Asia/Shanghai because Hong Kong's time zone abbrevation
changed from HKT to CST when it reverted to China last month (and
similarly for Macao in 1999).

	#! /bin/sh

	thisYear=`date +%Y`
	TZDIR=/usr/local/etc/zoneinfo
	TZs=`cd $TZDIR && find [A-Z]* -type f -print | sort`

	selectZdumpInfo='{
	  if ('$thisYear'<=$6) print $3, $4, $5, $6, $10, $11, $12, $13
	}'

	for TZ in $TZs
	do echo "`zdump -v $TZDIR/$TZ | awk "$selectZdumpInfo" | md5` $TZ"
	done |
	sort |
	awk '{
	  checksum = $1
	  TZ = $2
	  if (checksum != oldChecksum) print ""
	  print TZ
	  oldChecksum = checksum
	}'

This script outputs a series of TZ groups, each group preceded by an
empty line, and each group consisting of one or more lines specifying
a TZ value.  All the TZ values in a group have the same UTC offset
from this year on.

I ran this program on the latest TZ data.  The output started like this:

	Asia/Alma-Ata

	Australia/LHI
	Australia/Lord_Howe

	Etc/GMT+8
	SystemV/PST8

	America/Belize
	America/Costa_Rica
	America/El_Salvador
	America/Guatemala
	America/Regina
	America/Swift_Current
	America/Tegucigalpa
	Canada/East-Saskatchewan
	Canada/Saskatchewan
	Etc/GMT+6
	Pacific/Galapagos
	SystemV/CST6

	Asia/Novosibirsk
	Asia/Omsk

	...

That is, Asia/Alma-Ata has a unique time zone future; Australia/LHI
and Australia/Lord_Howe have the same time zone future (not too
surprising, since they're aliases); Etc/GMT+8 and SystemV/PST8 are
identical but no actual locations are 8 hours behind UTC all year so
we can ignore it; parts of Central America and Saskatchewan are 6
hours behind UTC all year; and so forth.

After quickly looking through the above output, I suggest the
following set of 95 entries from the tz database with unique UTC
offset futures.  For example, this list uses the name `Europe/Paris'
for CET/CEST (though perhaps `Europe/Brussels' would be more
appropriate :-).

Africa/Addis_Ababa
Africa/Algiers
Africa/Cairo
Africa/Casablanca
Africa/Johannesburg
Africa/Tripoli
Africa/Windhoek
America/Adak
America/Anchorage
America/Asuncion
America/Buenos_Aires
America/Caracas
America/Chicago
America/Cuiaba
America/Denver
America/Godthab
America/Grand_Turk
America/Halifax
America/Havana
America/Indianapolis
America/Los_Angeles
America/Miquelon
America/Montevideo
America/New_York
America/Phoenix
America/Port-au-Prince
America/Regina
America/Santiago
America/Sao_Paulo
America/St_Johns
Asia/Alma-Ata
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Baghdad
Asia/Baku
Asia/Beirut
Asia/Bishkek
Asia/Calcutta
Asia/Dacca
Asia/Damascus
Asia/Irkutsk
Asia/Jakarta
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Katmandu
Asia/Krasnoyarsk
Asia/Magadan
Asia/Novosibirsk
Asia/Rangoon
Asia/Shanghai
Asia/Tehran
Asia/Tokyo
Asia/Ulan_Bator
Asia/Vladivostok
Asia/Yakutsk
Asia/Yekaterinburg
Asia/Yerevan
Atlantic/Azores
Atlantic/Cape_Verde
Atlantic/Stanley
Australia/Adelaide
Australia/Brisbane
Australia/Darwin
Australia/Hobart
Australia/Lord_Howe
Australia/Sydney
Europe/Bucharest
Europe/Istanbul
Europe/London
Europe/Minsk
Europe/Moscow
Europe/Paris
Europe/Riga
Europe/Samara
Europe/Simferopol
Europe/Warsaw
Pacific/Auckland
Pacific/Chatham
Pacific/Easter
Pacific/Gambier
Pacific/Guadalcanal
Pacific/Honolulu
Pacific/Kiritimati
Pacific/Marquesas
Pacific/Norfolk
Pacific/Noumea
Pacific/Pitcairn
Pacific/Rarotonga
Pacific/Samoa
Pacific/Tongatapu
Pacific/Wake



More information about the tz mailing list