tz
The tz database attempts to record the history and predicted future of civil time scales. It organizes time zone and daylight saving time data by partitioning the world into timezones whose clocks all agree about timestamps that occur after the POSIX Epoch (1970-01-01 00:00:00 UTC). Although 1970 is a somewhat-arbitrary cutoff, there are significant challenges to moving the cutoff earlier even by a decade or two, due to the wide variety of local practices before computer timekeeping became prevalent. Most timezones correspond to a notable location and the database records all known clock transitions for that location; some timezones correspond instead to a fixed UTC offset.
Each timezone typically corresponds to a geographical region that is smaller than a traditional time zone, because clocks in a timezone all agree after 1970 whereas a traditional time zone merely specifies current standard time. For example, applications that deal with current and future timestamps in the traditional North American mountain time zone can choose from the timezones America/Denver which observes US-style daylight saving time (DST), and America/Phoenix which does not observe DST. Applications that also deal with past timestamps in the mountain time zone can choose from over a dozen timezones, such as America/Boise, America/Edmonton, and America/Hermosillo, each of which currently uses mountain time but differs from other timezones for some timestamps after 1970.
America/Denver
America/Phoenix
America/Boise
America/Edmonton
America/Hermosillo
Clock transitions before 1970 are recorded for location-based timezones, because most systems support timestamps before 1970 and could misbehave if data entries were omitted for pre-1970 transitions. However, the database is not designed for and does not suffice for applications requiring accurate handling of all past times everywhere, as it would take far too much effort and guesswork to record all details of pre-1970 civil timekeeping. Although some information outside the scope of the database is collected in a file backzone that is distributed along with the database proper, this file is less reliable and does not necessarily follow database guidelines.
backzone
As described below, reference source code for using the tz database is also available. The tz code is upwards compatible with POSIX, an international standard for UNIX-like systems. As of this writing, the current edition of POSIX is POSIX.1-2024, which has been published but not yet in HTML form. Unlike its predecessor POSIX.1-2017 ( The Open Group Base Specifications Issue 7, IEEE Std 1003.1-2017, 2018 Edition), POSIX.1-2024 requires support for the tz database, which has a model for describing civil time that is more complex than the standard and daylight saving times required by POSIX.1-2017. A tz timezone corresponds to a ruleset that can have more than two changes per year, these changes need not merely flip back and forth between two alternatives, and the rules themselves can change at times. Whether and when a timezone changes its clock, and even the timezone's notional base offset from UTC, are variable. It does not always make sense to talk about a timezone's "base offset", which is not necessarily a single number.
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 "Czech Republic" instead of the timezone name "Europe/Prague". If geolocation information is available, a selection interface can locate the user on a timezone map or prioritize names that are geographically close. For an example selection interface, see the tzselect program in the tz code. Unicode's Common Locale Data Repository (CLDR) contains data that may be useful for other selection interfaces; it maps timezone names like Europe/Prague to locale-dependent strings like "Prague", "Praha", "Прага", and "布拉格".
Europe/Prague
tzselect
The naming conventions attempt to strike a balance among the following goals:
Names normally have the format AREA/LOCATION, where AREA is a continent or ocean, and LOCATION is a specific location within the area. North and South America share the same area, 'America'. Typical names are 'Africa/Cairo', 'America/New_York', and 'Pacific/Honolulu'. Some names are further qualified to help avoid confusion; for example, 'America/Indiana/Petersburg' distinguishes Petersburg, Indiana from other Petersburgs in America.
/
America
Africa/Cairo
America/New_York
Pacific/Honolulu
America/Indiana/Petersburg
Here are the general guidelines used for choosing timezone names, in decreasing order of importance:
.
..
-
_
TZ
America/Noronha
America/Fernando_de_Noronha
//
Etc/Unknown
America/New_York/Bronx
Indian/Crozet
Asia/Dubai
America/Costa_Rica
America/San_Jose
America/Guyana
America/Georgetown
Europe/Paris
Europe/France
Europe/Rome
Europa/Roma
Europe/Athens
Ευρώπη/Αθήνα
Evrópi/Athína
Asia/Shanghai
Asia/Beijing
Europe/Milan
Atlantic/Canary
Atlantic/Canaries
_Islands
_City
America/Cayman
America/Cayman_Islands
America/Guatemala
America/Guatemala_City
America/Mexico_City
America/Mexico
Atlantic/St_Helena
Atlantic/St._Helena
backward
Asia/Calcutta
Asia/Kolkata
Guidelines have evolved with time, and names following old versions of these guidelines might not follow the current version. When guidelines have changed, old names continue to be supported. Guideline changes have included the following:
US/Eastern
WET
CET
MET
EET
europe
etcetera
Etc/GMT0
Etc/GMT-0
Etc/GMT+0
GMT0
GMT-0
GMT+0
northamerica
EST5EDT
CST6CDT
MST7MDT
PST8PDT
The file zone1970.tab 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 zone1970.tab location's longitude corresponds to its local mean time (LMT) offset with one hour for every 15° east longitude, this relationship is not exact. The backward-compatibility file zone.tab is similar but conforms to the older-version guidelines related to ISO 3166-1; it lists only one country code per entry and unlike zone1970.tab it can list names defined in backward. Applications that process only timestamps from now on can instead use the file zonenow.tab, which partitions the world more coarsely, into regions where clocks agree now and in the predicted future; this file is smaller and simpler than zone1970.tab and zone.tab.
zone1970.tab
zone.tab
zonenow.tab
The database defines each timezone name to be a zone, or a link to a zone. The source file backward defines links for backward compatibility; it does not define zones. Although backward was originally designed to be optional, nowadays distributions typically use it and no great weight should be attached to whether a link is defined in backward or in some other file. The source file etcetera defines names that may be useful on platforms that do not support proleptic TZ strings like <+08>-8; no other source file other than backward contains links to its zones. One of etcetera's names is Etc/UTC, used by functions like gmtime to obtain leap second information on platforms that support leap seconds. Another etcetera name, GMT, is used by older code releases.
<+08>-8
Etc/UTC
gmtime
GMT
When this package is installed, it generates time zone abbreviations like 'EST' to be compatible with human tradition and POSIX. Here are the general guidelines used for choosing time zone abbreviations, in decreasing order of importance:
EST
+
?
set `date`
In other words, in the C locale the POSIX extended regular expression [-+[:alnum:]]{3,6} should match the abbreviation. This guarantees that all abbreviations could have been specified explicitly by a POSIX proleptic TZ string.
[-+[:alnum:]]{3,6}
These abbreviations (for standard/daylight/etc. time) are: ACST/ACDT Australian Central, AST/ADT/APT/AWT/ADDT Atlantic, AEST/AEDT Australian Eastern, AHST/AHDT Alaska-Hawaii, AKST/AKDT Alaska, AWST/AWDT Australian Western, BST/BDT Bering, CAT/CAST Central Africa, CET/CEST/CEMT Central European, ChST Chamorro, CST/CDT/CWT/CPT Central [North America], CST/CDT China, GMT/BST/IST/BDST Greenwich, EAT East Africa, EST/EDT/EWT/EPT Eastern [North America], EET/EEST Eastern European, GST/GDT Guam, HST/HDT/HWT/HPT Hawaii, HKT/HKST/HKWT Hong Kong, IST India, IST/GMT Irish, IST/IDT/IDDT Israel, JST/JDT Japan, KST/KDT Korea, MET/MEST Middle European (a backward-compatibility alias for Central European), MSK/MSD Moscow, MST/MDT/MWT/MPT Mountain, NST/NDT/NWT/NPT/NDDT Newfoundland, NST/NDT/NWT/NPT Nome, NZMT/NZST New Zealand through 1945, NZST/NZDT New Zealand 1946–present, PKT/PKST Pakistan, PST/PDT/PWT/PPT Pacific, PST/PDT Philippine, SAST South Africa, SST Samoa, UTC Universal, WAT/WAST West Africa, WET/WEST/WEMT Western European, WIB Waktu Indonesia Barat, WIT Waktu Indonesia Timur, WITA Waktu Indonesia Tengah, YST/YDT/YWT/YPT/YDDT Yukon.
For times taken from a city's longitude, use the traditional xMT notation. The only abbreviation like this in current use is 'GMT'. The others are for timestamps before 1960, except that Monrovia Mean Time persisted until 1972. Typically, numeric abbreviations (e.g., '-004430' for MMT) would cause trouble here, as the numeric strings would exceed the POSIX length limit.
These abbreviations are: AMT Asunción, Athens; BMT Baghdad, Bangkok, Batavia, Bermuda, Bern, Bogotá, Brussels, Bucharest; CMT Calamarca, Caracas, Chisinau, Colón, Córdoba; DMT Dublin/Dunsink; EMT Easter; FFMT Fort-de-France; FMT Funchal; GMT Greenwich; HMT Havana, Helsinki, Horta, Howrah; IMT Irkutsk, Istanbul; JMT Jerusalem; KMT Kaunas, Kyiv, Kingston; LMT Lima, Lisbon, local; MMT Macassar, Madras, Malé, Managua, Minsk, Monrovia, Montevideo, Moratuwa, Moscow; PLMT Phù Liễn; PMT Paramaribo, Paris, Perm, Pontianak, Prague; PMMT Port Moresby; PPMT Port-au-Prince; QMT Quito; RMT Rangoon, Riga, Rome; SDMT Santo Domingo; SJMT San José; SMT Santiago, Simferopol, Singapore, Stanley; TBMT Tbilisi; TMT Tallinn, Tehran; WMT Warsaw.
A few abbreviations also follow the pattern that GMT/BST established for time in the UK. They are: BMT/BST for Bermuda 1890–1930, CMT/BST for Calamarca Mean Time and Bolivian Summer Time 1890–1932, DMT/IST for Dublin/Dunsink Mean Time and Irish Summer Time 1880–1916, MMT/MST/MDST for Moscow 1880–1919, and RMT/LST for Riga Mean Time and Latvian Summer time 1880–1926.
zic
%z
Application writers should note that these abbreviations are ambiguous in practice: e.g., 'CST' means one thing in China and something else in North America, and 'IST' can refer to time in India, Ireland or Israel. To avoid ambiguity, use numeric UT offsets like '-0600' instead of time zone abbreviations like 'CST'.
The tz database is not authoritative, and it surely has errors. Corrections are welcome and encouraged; see the file CONTRIBUTING. Users requiring authoritative data should consult national standards bodies and the references cited in the database's comments.
CONTRIBUTING
Errors in the tz database arise from many sources:
Europe/London
America/Kentucky/Louisville
tz Rule
Zone
Rule
<-03>3
America/Cayenne
Africa/Nairobi
In short, many, perhaps most, of the tz database's pre-1970 and future timestamps are either wrong or misleading. Any attempt to pass the tz database off as the definition of time should be unacceptable to anybody who cares about the facts. In particular, the tz database's LMT offsets should not be considered meaningful, and should not prompt creation of timezones merely because two locations differ in LMT or transitioned to standard time at different dates.
The tz code contains time and date functions that are upwards compatible with those of POSIX. Code compatible with this package is already part of many platforms, where the primary use of this package is to update obsolete time-related files. To do this, you may need to compile the time zone compiler zic supplied with this package instead of using the system zic, since the format of zic's input is occasionally extended, and a platform may still be shipping an older zic.
In POSIX, time display in a process is controlled by the environment variable TZ, which can have two forms:
CET-1CEST,M3.5.0,M10.5.0/3
Europe/Berlin
Some platforms support only the features required by POSIX.1-2017, and have not yet upgraded to POSIX.1-2024. Code intended to be portable to these platforms must deal with problems that were fixed in later POSIX editions.
The proleptic TZ string, which is all that POSIX.1-2017 requires, has a format that is hard to describe and is error-prone in practice. Also, proleptic TZ strings cannot deal with daylight saving time rules not based on the Gregorian calendar (as in Morocco), or with situations where more than two time zone abbreviations or UT offsets are used in an area.
A proleptic TZ string has the following format:
stdoffset[dst[offset][,date[/time],date[/time]]]
,
where:
<+09>
[±]hh:[mm[:ss]]
:
M
5
J
Here is an example proleptic TZ string for New Zealand after 2007. It says that standard time (NZST) is 12 hours ahead of UT, and that daylight saving time (NZDT) is observed from September's last Sunday at 02:00 until April's first Sunday at 03:00:
TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'
This proleptic TZ string is hard to remember, and mishandles some timestamps before 2008. With this package you can use a geographical TZ instead:
TZ='Pacific/Auckland'
POSIX.1-2017 also has the limitations of POSIX.1-2024, discussed in the next section.
POSIX.1-2024 extends POSIX.1-2017 in the following significant ways:
struct tm
tm_gmtoff
tm_zone
"<-02>2<-01>,M3.5.0/-1,M10.5.0/0"
However POSIX.1-2024, like earlier POSIX editions, has some limitations:
time_t
The tz code defines some properties left unspecified by POSIX, and attempts to support some extensions to POSIX.
If the TZ environment variable uses the geographical format, it is used in generating the name of a file from which time-related information is read. The file's format is TZif, a timezone information format that contains binary data; see Internet RFC 9636. The daylight saving time rules to be used for a particular timezone are encoded in the TZif file; the format of the file allows US, Australian, and other rules to be encoded, and allows for situations where more than two time zone abbreviations are used.
When the tz code was developed in the 1980s, it was recognized that allowing the TZ environment variable to take on values such as 'America/New_York' might cause "old" programs (that expect TZ to have a certain format) to operate incorrectly; consideration was given to using some other environment variable (for example, TIMEZONE) to hold the string used to generate the TZif file's name. In the end, however, it was decided to continue using TZ: it is widely used for time zone purposes; separately maintaining both TZ and TIMEZONE seemed a nuisance; and systems where "new" forms of TZ might cause problems can simply use legacy TZ values such as "EST5EDT" which can be used by "new" programs as well as by "old" programs that assume pre-POSIX TZ values.
TIMEZONE
tzalloc
tzfree
localtime_rz
mktime_z
timezone_t
localtime_r
mktime
POSIX and ISO C define some APIs that are vestigial: they are not needed, and are relics of a too-simple model that does not suffice to handle many real-world timestamps. Although the tz code supports these vestigial APIs for backwards compatibility, they should be avoided in portable applications. The vestigial APIs are:
tzname
strftime
"%Z"
daylight
timezone
localtime
"%z"
"+0900"
tm_isdst
localtime(&clock)->tm_zone
TM_ZONE
%Z
gettimeofday
STD_INSPIRED
The tz code and data supply the following interfaces:
zdump
tzfile
iso3166.tab
version
Interface changes in a release attempt to preserve compatibility with recent releases. For example, tz data files typically do not rely on recently added zic features, so that users can run older zic versions to process newer data files. Downloading the tz database describes how releases are tagged and distributed.
Interfaces not listed above are less stable. For example, users should not rely on particular UT offsets or abbreviations for timestamps, as data entries are often based on guesswork and these guesses may be corrected or improved.
Timezone boundaries are not part of the stable interface. For example, even though the Asia/Bangkok 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 "Asia/Bangkok" in the event's record, the application should be robust in the presence of timezone splits between now and the future time.
Leap seconds were introduced in 1972 to accommodate the difference between atomic time and the less regular rotation of the earth. Unfortunately they have caused so many problems with civil timekeeping that there are plans to discontinue them by 2035. Even if these plans come to fruition, a record of leap seconds will still be needed to resolve timestamps from 1972 through 2035, and there may also be a need to record whatever mechanism replaces them.
The tz code and data can account for leap seconds, thanks to code contributed by Bradley White. However, the leap second support of this package is rarely used directly because POSIX requires leap seconds to be excluded and many software packages would mishandle leap seconds if they were present. Instead, leap seconds are more commonly handled by occasionally adjusting the operating system kernel clock as described in Precision timekeeping, and this package by default installs a leapseconds file commonly used by NTP software that adjusts the kernel clock. However, kernel-clock twiddling approximates UTC only roughly, and systems needing more precise UTC can use this package's leap second support directly.
The directly supported mechanism assumes that time_t counts of seconds since the POSIX epoch normally include leap seconds, as opposed to POSIX time_t counts which exclude leap seconds. This modified timescale is converted to UTC at the same point that time zone and DST adjustments are applied – namely, at calls to localtime and analogous functions – and the process is driven by leap second information stored in alternate versions of the TZif files. Because a leap second adjustment may be needed even if no time zone correction is desired, calls to gmtime-like functions also need to consult a TZif file, conventionally named Etc/UTC (GMT in previous versions), to see whether leap second corrections are needed. To convert an application's time_t timestamps to or from POSIX time_t timestamps (for use when, say, embedding or interpreting timestamps in portable tar files), the application can call the utility functions time2posix and posix2time included with this package.
tar
time2posix
posix2time
If the POSIX-compatible TZif file set is installed in a directory whose basename is zoneinfo, the leap-second-aware file set is by default installed in a separate directory zoneinfo-leaps. Although each process can have its own time zone by setting its TZ environment variable, there is no support for some processes being leap-second aware while other processes are POSIX-compatible; the leap-second choice is system-wide. So if you configure your kernel to count leap seconds, you should also discard zoneinfo and rename zoneinfo-leaps to zoneinfo. Alternatively, you can install just one set of TZif files in the first place; see the REDO variable in this package's makefile.
REDO
Calendrical issues are a bit out of scope for a time zone database, but they indicate the sort of problems that we would run into if we extended the time zone database further into the past. An excellent resource in this area is Edward M. Reingold and Nachum Dershowitz, Calendrical Calculations: The Ultimate Edition, Cambridge University Press (2018). Other information and sources are given in the file 'calendars' in the tz distribution. They sometimes disagree.
calendars
The European Space Agency is considering the establishment of a reference timescale for the Moon, which has days roughly equivalent to 29.5 Earth days, and where relativistic effects cause clocks to tick slightly faster than on Earth. Also, NASA has been ordered to consider the establishment of Coordinated Lunar Time (LTC). It is not yet known whether the US and European efforts will result in multiple timescales on the Moon.
Some people's work schedules have used Mars time. Jet Propulsion Laboratory (JPL) coordinators kept Mars time on and off during the Mars Pathfinder mission (1997). Some of their family members also adapted to Mars time. Dozens of special Mars watches were built for JPL workers who kept Mars time during the Mars Exploration Rovers (MER) mission (2004–2018). These timepieces looked like normal Seikos and Citizens but were adjusted to use Mars seconds rather than terrestrial seconds, although unfortunately the adjusted watches were unreliable and appear to have had only limited use.
A Mars solar day is called a "sol" and has a mean period equal to about 24 hours 39 minutes 35.244 seconds in terrestrial time. It is divided into a conventional 24-hour clock, so each Mars second equals about 1.02749125 terrestrial seconds. (One MER worker noted, "If I am working Mars hours, and Mars hours are 2.5% more than Earth hours, shouldn't I get an extra 2.5% pay raise?")
The prime meridian of Mars goes through the center of the crater Airy-0, named in honor of the British astronomer who built the Greenwich telescope that defines Earth's prime meridian. Mean solar time on the Mars prime meridian is called Mars Coordinated Time (MTC).
Each landed mission on Mars has adopted a different reference for solar timekeeping, so there is no real standard for Mars time zones. For example, the MER mission defined two time zones "Local Solar Time A" and "Local Solar Time B" for its two missions, each zone designed so that its time equals local true solar time at approximately the middle of the nominal mission. The A and B zones differ enough so that an MER worker assigned to the A zone might suffer "Mars lag" when switching to work in the B zone. Such a "time zone" is not particularly suited for any application other than the mission itself.
Many calendars have been proposed for Mars, but none have achieved wide acceptance. Astronomers often use Mars Sol Date (MSD) which is a sequential count of Mars solar days elapsed since about 1873-12-29 12:00 GMT.
In our solar system, Mars is the planet with time and calendar most like Earth's. On other planets, Sun-based time and calendars would work quite differently. For example, although Mercury's sidereal rotation period is 58.646 Earth days, Mercury revolves around the Sun so rapidly that an observer on Mercury's equator would see a sunrise only every 175.97 Earth days, i.e., a Mercury year is 0.5 of a Mercury day. Venus is more complicated, partly because its rotation is slightly retrograde: its year is 1.92 of its days. Gas giants like Jupiter are trickier still, as their polar and equatorial regions rotate at different rates, so that the length of a day depends on latitude. This effect is most pronounced on Neptune, where the day is about 12 hours at the poles and 18 hours at the equator.
Although the tz database does not support time on other planets, it is documented here in the hopes that support will be added eventually.
Sources for time on other planets: