[tz] Posix time zone question

Zefram zefram at fysh.org
Wed Jan 11 21:57:50 UTC 2012


Donald MacQueen wrote:
>1) What is the difference between America/Detroit and posix/America/Detroit?

They're the same thing, but you're not meant to use names starting
"posix/" as timezone names.  The "posix/" prefix is concerned with two
different ways a time_t value can be interpreted for post-1972 times:
the posix/ files are for the standard way, where time_t encodes a UTC
timestamp, and the right/ files are for an alternative, where time_t
counts UTC seconds linearly.  The two differ around leap seconds.

Short version: you want the posix/ files, don't touch right/ unless
you understood the above, and the timezone is named "America/Detroit"
and not "posix/America/Detroit".

>2) Where is the format of the tz source filesdescribed?

Not formally described anywhere.  zic.c is canonical in interpreting it,
but it's not the easiest code to read.

>SAVE and Letter/S mean below?

SAVE says how far ahead of the zone's "standard" time clocks should be set
for the period covered by that rule.  SAVE=1:00 is the usual DST value,
and SAVE=0:00 means DST is not in effect.

LETTER/S provides some letters that can be included in the zone
abbreviation specified by FORMAT.  The US rules have letters "S" for
standard and "D" for DST, and America/Detroit specifies format "E%sT",
yielding abbreviations "EST" and "EDT".  Many zones don't use this
facility, and put a complete abbreviation into FORMAT.

>I am also interested in what the Link format is.

A Link means that two zone names are synonymous.  E.g., "Link
America/Denver America/Shiprock" defines America/Shiprock as an alias
for America/Denver; America/Denver is described elsewhere in the file.

>3) AIX machines use their own wacky format such at TZ=EST5EDT. Is there any
>decent mapping to real names?

"EST5EDT" is a POSIX standard format for $TZ, specifying standard and
DST offsets and abbreviations.  It can (and should) have a further
clause added to specify a rule for transition dates, but it's only
a single rule for all years.  Olson tzfiles (in version 2) actually
use this format internally, to specify how to handle dates beyond
the enumerated transitions; you can pull this data out with "tail -n1
/usr/share/zoneinfo/America/Detroit", for example.

In general a POSIX-format $TZ value cannot be converted to an Olson
zone name, because it's ambiguous.  For example, "EST5EDT" (even
with the transition rule) is ambiguous between America/Detroit and
America/New_York, which behave differently in the past.

However, AIX is a little more complicated.  For certain
specifically-recognised POSIX-format $TZ values, lacking explicit DST
transition rules, it knows the proper transition rule for some civil
timezone that has a nearly-matching offset and abbreviation.  Actually
the abbreviations in the zone name often don't match the abbreviations
actually used in those civil timezones, and in some cases the offset
is wrong.  I looked into this a few months ago, and came up with this
translation table, which I believe covers all the special AIX values:

	AIX value           means
	CUT0GDT             CUT0
        GMT0BST             Europe/London
	WET0WEST            WET
	AZOREST1AZOREDT     Atlantic/Azores
	FALKST2FALKDT       Atlantic/Stanley
	GRNLNDST3GRNLNDDT   America/Godthab
	AST4ADT             America/Campo_Grande
	EST5EDT             America/New_York
	CST6CDT             America/Chicago
	MST7MDT             America/Denver
	PST8PDT             America/Los_Angeles
	AST9ADT             America/Anchorage
	HST10HDT            Pacific/Honolulu
	BST11BDT            America/Adak
	NZST-12NZDT         Pacific/Auckland
	MET-11METDT         Pacific/Guadalcanal
	EET-10EETDT         Australia/Sydney
	JST-9JSTDT          Asia/Tokyo
	KORST-9KORDT        Asia/Seoul
	WAUST-8WAUDT        Australia/Perth
	TAIST-8TAIDT        Asia/Taipei
	THAIST-7THAIDT      Asia/Bangkok
	TASHST-6TASHDT      Asia/Tashkent
	PAKST-5PAKDT        Asia/Karachi
	WST-4WDT            Asia/Muscat
	MEST-3MEDT          Europe/Istanbul
	SAUST-3SAUDT        Asia/Riyadh
	EET-2EEST           EET
	USAST-2USADT        Africa/Johannesburg
	CET-1CEST           CET

The "CUT0" meaning is actually another POSIX $TZ value, not an Olson name,
and it refers to constant UT+0h, with no DST, and constant abbreviation
"CUT".  In some cases the choice of Olson zone is a bit arbitrary, such
as for America/New_York.  Not having an AIX system myself, I'm not clear
on whether AIX implements the historical progression of DST rules for each
zone, which would distinguish the ambiguous cases.  I'm likewise not clear
whether, where the abbreviations are wrong, AIX uses the abbreviation
in the zone name (as POSIX requires) or uses the correct abbreviation.

I'd be interested to see the results of "zdump -v" on AIX for its special
zone names.  Best mail me off-list if you acquire this output, because
it'll be a bit big.

I understand that recent AIX supports Olson zones, so you shouldn't need
to stick with "EST5EDT"-like names.

-zefram



More information about the tz mailing list