The public-domain time zone database contains code and data
that represent the history of local time
for many representative locations around the globe.
It is updated periodically to reflect changes made by political bodies
to time zone
boundaries, UTC offsets, and
daylight-saving
rules.
This database (often called tz or zoneinfo)
is used by several implementations,
including
the
GNU
C Library used in
GNU/Linux,
FreeBSD,
NetBSD,
OpenBSD,
Cygwin,
DJGPP,
HP-UX,
IRIX,
Mac OS X,
OpenVMS,
Solaris,
Tru64, and
UnixWare.
Each location in the database represents a national region where all
clocks keeping local time have agreed since 1970.
Locations are identified by continent or ocean and then by the name of
the location, which is typically the largest city within the region.
For example, America/New_York
represents most of the US eastern time zone;
America/Phoenix represents most of Arizona, which
uses mountain time without daylight saving time (DST);
America/Detroit represents most of Michigan, which uses
eastern time but with different DST rules in 1975;
and other entries represent smaller regions like Starke County,
Indiana, which switched from central to eastern time in 1991
and switched back in 2006.
To use the database on an extended POSIX
implementation set the TZ environment variable to
the location's full name, e.g., TZ="America/New_York".
In the tz database's
FTP distribution
the code is in the file tzcodeC.tar.gz,
where C is the code's version;
similarly, the data are in tzdataD.tar.gz,
where D is the data's version.
The following shell commands download
these files to a GNU/Linux or similar host;
see the downloaded
README file for what to do next.
wget 'ftp://elsie.nci.nih.gov/pub/tz*.tar.gz'
gzip -dc tzcode*.tar.gz | tar -xf -
gzip -dc tzdata*.tar.gz | tar -xf -
The code lets you compile the tz source files into
machine-readable binary files, one for each location. It also lets
you read a tz binary file and interpret time stamps for that
location.
Time
Zone Registry proposes an IANA time zone
registration process that would establish unique names for each
version of each tz zone, along with a polygonal
representation of the geographical area corresponding to the
zone. (This draft has expired, though.)
DateTime::TimeZone
contains a script parse_olson that compiles
tz source into Perl
modules. It is part of the Perl DateTime Project, which is freely
available under both the GPL and the Perl Artistic
License. DateTime::TimeZone also contains a script
tests_from_zdump that generates test cases for each clock
transition in the tz database.
ICU
contains a C/C++ library for internationalization that
has a compiler from tz source
into an ICU-specific format.
ICU is freely available under a
BSD-style license.
Joda Time - Java date
and time API
contains a class
org.joda.time.tz.ZoneInfoCompiler that compiles
tz source into a Joda-specific binary format. Joda Time
is freely available under a BSD-style license.
Starting with version 8.5, Tcl
contains a developer-oriented parser that compiles tz
source into text files, along with a runtime that can read those
files. Tcl is freely available under a BSD-style
license.
Other tz binary file readers
The GNU C
Library
has an independent, thread-safe implementation of
a tz binary file reader.
This library is freely available under the
GNU Lesser General Public License
(LGPL),
and is widely used in GNU/Linux systems.
ZoneInfo.java
is a tz binary file reader written in Java.
It is freely available under the LGPL.
Python time zones
is a tz binary file reader written in Python.
It is freely available under a BSD-style license.
Tcl, mentioned above, also contains a
tz binary file reader.
Other tz-based time zone software
International
clock (intclock) is a multi-timezone clock for
GNU/Linux and similar systems. It is freely available
under the GPL.
Sun Java releases since 1.4
contain a copy of a subset of a recent tz database in a
Java-specific format.
World Time Zones
contains data from the Time Service Department of the
US Naval Observatory, used as the source
for the usno* files in the tz distribution.
Astronomical
Times explains more abstruse astronomical time scales like
TDT,
TCG, and
TDB.
Time
Scales goes into more detail, particularly for historical variants.
The IAU's SOFA
initiative publishes Fortran
code for converting among time scales like
TAI,
TDB, TDT and
UTC.
LeapSecond.com is
dedicated not only to leap seconds but to precise time and frequency
in general. It covers the state of the art in amateur timekeeping, and
how the art has progressed over the past few decades.
Bulletins
maintained by the
IERS
EOP
(PC) contains official publications of
the Earth Orientation Parameters Product Center of the
International Earth Rotation Service, the committee that decides
when leap seconds occur.
ICU
contains a mechanism for localizing time zone
labels and abbreviations; for example, one can use it to specify
Russian translations for "Eastern European Summer Time",
"EEST",
and Europe/Bucharest.
This mechanism is part of the
Unicode
CLDR Project;
for example, the CLDR Sideways Data for dates_timeZoneNames
shows values for time zone names in many locales.
Alphabetic time zone abbreviations should not be used as unique
identifiers for UTC offsets as they are ambiguous in
practice. For example, "EST" denotes 5 hours behind
UTC in English-speaking North America, but it denotes 10
or 11 hours ahead of UTC in Australia; and
French-speaking North Americans prefer
"HNE" to
"EST". For POSIX the tz
database contains English abbreviations for all time stamps but in
many cases these are merely inventions of the database
maintainers.
Numeric time zone abbreviations typically count hours east of
UTC, e.g., +09 for Japan and
-10 for Hawaii. However, the POSIX
TZ environment variable uses the opposite convention. For
example, one might use TZ="JST-9" and
TZ="HST10" for Japan and Hawaii, respectively. If the
tz database is available, it is usually better to use
settings like TZ="Asia/Tokyo" and
TZ="Pacific/Honolulu" instead, as this should avoid
confusion, handle old time stamps better, and insulate you better from
any future changes to the rules. One should never set
POSIX TZ to a value like
"GMT-9", though, since this would falsely claim that
local time is nine hours ahead of UTC and the time zone
is called "GMT".