Tz database
View on Wikipedia

The tz database is a collaborative compilation of information about the world's time zones and rules for observing daylight saving time, primarily intended for use with computer programs and operating systems.[2] Paul Eggert has been its editor and maintainer since 2005,[3] with the organizational backing of ICANN.[4] The tz database is also known as tzdata, the zoneinfo database or the IANA time zone database (after the Internet Assigned Numbers Authority), and occasionally as the Olson database, referring to the founding contributor, Arthur David Olson.[5]
Its uniform naming convention for entries in the database, such as America/New_York and Europe/Paris, was designed by Paul Eggert.[6] The database attempts to record historical time zones and all civil changes since 1970, the Unix time epoch.[7] It also records leap seconds.[8]
The database, as well as some reference source code, is in the public domain.[9] New editions of the database and code are published as changes warrant, usually several times per year.[10]
Data structure
[edit]Definition of a timezone
[edit]Within the tz database, a timezone is any national region where local clocks have all agreed since 1970.[11] This definition concerns itself first with geographic areas which have had consistent local clocks. A timezone is different from a region with a particular standard time offset from UTC, which is often referred to as a "time zone". Therefore, each of the timezones defined by the tz database may use multiple offsets from UTC, such as offsets for standard time and daylight saving time.[12]
File formats
[edit]The tz database is published as a set of text files which list the rules and zone transitions in a human-readable format. For use, these text files are compiled into a set of platform-independent binary files—one per timezone. The reference source code includes such a compiler called zic (zone information compiler), as well as code to read those files and use them in standard APIs such as localtime() and mktime().
Timezones
[edit]Each timezone has one or more "zone lines" in one of the tz database text files. The first zone line for a timezone gives the name of the timezone; any subsequent zone lines for that timezone leave the name blank, indicating that they apply to the same zone as the previous line. Each zone line for a zone specifies, for a range of date and time, the offset to UTC for standard time, the name of the set of rules that govern daylight saving time (or a hyphen if standard time always applies), the format for time zone abbreviations, and, for all but the last zone line, the date and time at which the range of date and time governed by that line ends.
Daylight saving time (DST) rules
[edit]The rules for daylight saving time are specified in named rule sets. Each rule set has one or more rule lines in the text files. A rule line contains the name of the rule set to which it belongs, the first year in which the rule applies, the last year in which the rule applies (or "only" if it applies only in one year or "max" if it is the rule then in effect), the type of year to which the rule applies ("-" if it applies to all years in the specified range, which is almost always the case, otherwise a name used as an argument to a script that indicates whether the year is of the specified type), the month in which the rule takes effect, the day on which the rule takes effect (which could either be a specific day or a specification such as "the last Sunday of the month"), the time of day at which the rule takes effect, the amount of time to add to the offset to UTC when the rule is in effect, and the letter or letters to use in the time zone abbreviation (for example, "S" if the rule governs standard time and "D" if it governs daylight saving time).
Names of timezones
[edit]The timezones have unique names in the form "Area/Location", e.g. "America/New_York". A choice was also made to use English names or equivalents, and to omit punctuation and common suffixes. The underscore character is used in place of spaces. Hyphens are used where they appear in the name of a location. The Area and Location names each have a maximum length of 14 characters.[13][14]
Area
[edit]Area is the name of a continent, an ocean, or "Etc". The continents and oceans used are Africa, America, Antarctica, Arctic, Asia, Atlantic, Australia, Europe, Indian, and Pacific.
The oceans are included since some islands are hard to connect to a certain continent. Some are geographically connected to one continent and politically to another. See also Boundaries between continents.
The special area of "Etc" is used for some administrative zones, particularly for "Etc/UTC" which represents Coordinated Universal Time. In order to conform with the POSIX style, those zone names beginning with "Etc/GMT" have their sign reversed from the standard ISO 8601 convention. In the "Etc" area, zones west of GMT have a positive sign and those east have a negative sign in their name (e.g "Etc/GMT-14" is 14 hours ahead of GMT).
Location
[edit]Location is the name of a specific location within the area – usually a city or small island.
Country names are not normally used in this scheme, primarily because they would not be robust, owing to frequent political and boundary changes. The names of large cities tend to be more permanent.[15] Usually the most populous city in a region is chosen to represent the entire timezone, although another city may be selected if it is more widely known, and another location, including a location other than a city, may be used if it results in a less ambiguous name.[16] In the event that the name of the location used to represent the timezone changes, the convention is to create an alias[17] in future editions so that both the old and new names refer to the same database entry.
In some cases the Location is itself represented as a compound name, for example the timezone "America/Indiana/Indianapolis". Three-level names include those under "America/Argentina/...", "America/Kentucky/...", "America/Indiana/...", and "America/North_Dakota/...".
The location selected is representative of the entire area; that is, the current time at the location is the same as the current time in the entire zone. However, this does not necessarily hold for periods before 1970. That is, the time zone rules are only guaranteed to be correct for the named location for times before 1970; if there were time differences within the area before 1970, the time zone rules only apply in the named location for that period.
Examples
[edit]| Name | Explanation |
|---|---|
| America/Costa_Rica | name of country used because the name of the largest city (and capital city) San José is ambiguous |
| America/New_York | Space replaced with underscore |
| Asia/Kolkata | name of city of Kolkata used, because it was the most populous city in the zone at the time the zone was set up[18] |
| Asia/Sakhalin | name of island used, because largest city, Yuzhno-Sakhalinsk, has more than 14 characters |
| America/Bahia_Banderas | "de" removed from Bahia de Banderas, because correct name has more than 14 characters |
| Antarctica/DumontDUrville | the apostrophe is removed. The space would normally be replaced with "_", but the name would then exceed 14 characters. |
Example zone and rule lines
[edit]These are rule lines for the standard United States daylight saving time rules, rule lines for the daylight saving time rules in effect in the US Eastern Time Zone (called "NYC" as New York City is the city representing that zone) in some years, and zone lines for the America/New_York timezone, as of release version tzdata2011n of the time zone database. The zone and rule lines reflect the history of DST in the United States.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule US 1918 1919 - Mar lastSun 2:00 1:00 D
Rule US 1918 1919 - Oct lastSun 2:00 0 S
Rule US 1942 only - Feb 9 2:00 1:00 W # War
Rule US 1945 only - Aug 14 23:00u 1:00 P # Peace
Rule US 1945 only - Sep 30 2:00 0 S
Rule US 1967 2006 - Oct lastSun 2:00 0 S
Rule US 1967 1973 - Apr lastSun 2:00 1:00 D
Rule US 1974 only - Jan 6 2:00 1:00 D
Rule US 1975 only - Feb 23 2:00 1:00 D
Rule US 1976 1986 - Apr lastSun 2:00 1:00 D
Rule US 1987 2006 - Apr Sun>=1 2:00 1:00 D
Rule US 2007 max - Mar Sun>=8 2:00 1:00 D
Rule US 2007 max - Nov Sun>=1 2:00 0 S
....
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule NYC 1920 only - Mar lastSun 2:00 1:00 D
Rule NYC 1920 only - Oct lastSun 2:00 0 S
Rule NYC 1921 1966 - Apr lastSun 2:00 1:00 D
Rule NYC 1921 1954 - Sep lastSun 2:00 0 S
Rule NYC 1955 1966 - Oct lastSun 2:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/New_York -4:56:02 - LMT 1883 November 18, 12:03:58
-5:00 US E%sT 1920
-5:00 NYC E%sT 1942
-5:00 US E%sT 1946
-5:00 NYC E%sT 1967
-5:00 US E%sT
Data stored for each zone
[edit]For each timezone that has multiple offsets (usually due to daylight saving time), the tz database records the exact moment of transition. The format can accommodate changes in the dates and times of transitions as well. Zones may have historical rule changes going back many decades (as shown in the example above).
Zone.tab
[edit]The file zone.tab is in the public domain and lists the zones. Columns and row sorting are described in the comments of the file, as follows:
# This file contains a table with the following columns: # 1. ISO 3166 2-character country code. 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. # 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 zones first, where that does not contradict (1).
Data before 1970
[edit]Data before 1970 aims to be correct for the city identifying the region, but is not necessarily correct for the entire region. This is because new regions are created only as required to distinguish clocks since 1970.
For example, between 1963-10-23 and 1963-12-09 in Brazil only the states of Minas Gerais, Espírito Santo, Rio de Janeiro, and São Paulo had summer time. However, a requested split from America/Sao_Paulo was rejected in 2010 with the reasoning that, since 1970, the clocks were the same in the whole region.[19]
Time in Germany, which is represented by Europe/Berlin, is incorrect for the year 1945 when the Trizone used daylight saving time rules different from Berlin's.[20]
Coverage
[edit]Zones covering multiple post-1970 countries
[edit]There are two zones that cover an area that was covered by two countries after 1970. The database follows the definitions of countries as per ISO 3166-1, whose predecessor, ISO 3166, was first published in 1974.
- Asia/Aden – two countries until 1990: North Yemen (ISO 3166-1: YE; capital Sana'a) and South Yemen (People's Republic, ISO 3166-1: YD, ISO 3166-3: YDYE; capital: Aden).
- Europe/Berlin – two countries until 1990: East Germany (ISO 3166-1: DD, ISO 3166-3: DDDE) and West Germany (ISO 3166-1: DE)
Maintenance
[edit]The tz reference code and database is maintained by a group of volunteers. Arthur David Olson makes most of the changes to the tz reference code. Paul Eggert makes most of the changes to the tz database. Proposed changes are sent to the tz mailing list, which is gatewayed to the comp.time.tz Usenet newsgroup. Source files are distributed via the IANA FTP server. Typically, these files are taken by a software distributor like Debian, compiled, and then the source and binaries are packaged as part of that distribution. End users can either rely on their software distribution's update procedures, which may entail some delay, or obtain the source directly and build the binary files themselves. The IETF has published RFC 6557, "Procedures for Maintaining the Time Zone Database" documenting best practices based on similar principles.
Unix-like systems
[edit]The standard path for the timezone database is /usr/share/zoneinfo/ in Linux distributions, macOS, and some other Unix-like systems.
Usage and extensions
[edit]Boundaries of timezones
[edit]Geographical boundaries in the form of coordinate sets are not part of the tz database, but boundaries are published by Evan Siroky[1] in GeoJSON and shapefile formats.
Use in other standards
[edit]The Unicode Common Locale Data Repository (CLDR) refers to zones in the tz database. However, as the name for a zone can change from one tz database release to another, the CLDR assigns the UN/LOCODE for the city used in the name for the zone, or an internally-assigned code if there is no such city for the zone, to a tzdb zone.[21][22]
Use in software systems
[edit]The tz database is used for time zone processing and conversions in many computer software systems, including:
- BSD-derived systems, including FreeBSD, NetBSD, OpenBSD, DragonFly BSD, macOS, and iOS (they also use the reference TZ database processing code as their TZ POSIX API implementation);
- the GNU C Library and systems that use it, including GNU, most Linux distributions, BeOS, Haiku, Nexenta OS, and Cygwin;
- System V Release 4-derived systems, such as Solaris and UnixWare;
- AIX 6.1 and later[23][24] (earlier versions of AIX, starting with AIX 5.2, include zoneinfo,[25] for support of third-party applications such as MySQL,[26] but do not use it themselves[25][27]);
- Android[28]
- several other Unix systems, including IRIX, Tru64, SunOS 4.x,[29] and UNICOS/mp;
- OpenVMS;
- the Java Runtime Environment since release 1.8 (2014), see java.time.ZoneId
- the Perl modules DateTime::TimeZone and DateTime::LeapSecond since 2003;
- PHP releases since 5.1.0 (2005);
- the Ruby Gem TZInfo;
- the Python standard library zoneinfo module, the first-party tzdata package, and the third-party pytz package;
- the JavaScript language specification for Internationalization explicitly specifies the usage of IANA Time Zone names for API, and recommends the usage of the time zone data as well.[30]
- Numerous libraries also available: timezone-js, BigEasy/TimeZone, WallTime-js and moment-timezone;
- the Pandas (Python) module pandas – Python Data Analysis Library;
- the .NET Framework libraries NodaTime, TZ4Net and zoneinfo Archived 24 December 2017 at the Wayback Machine;
- the Haskell libraries timezone-series and timezone-olson;
- the Erlang module ezic;
- The Go standard library time package;
- The Rust crate chrono-tz;
- The Squeak Smalltalk time package;
- The C++ libraries Boost and Qt, and C++20 chrono standard library's
std::chrono::tzdb; - The Delphi and Free Pascal library TZDB;[31]
- The Free Pascal library PascalTZ;
- The Tool Command Language has a clock command using tzdata;
- Oracle releases since 10g (2004);[32]
- PostgreSQL since release 8.0 (2005);
- the Microsoft SQL Server library SQL Server Time Zone Support
- MongoDB since release 3.6;
- the Dart/Flutter Timezone package in pub;
- embedded software such as the firmware used in IP clocks.
The Olson timezone IDs are also used by the Unicode Common Locale Data Repository (CLDR) and International Components for Unicode (ICU). For example, the CLDR Windows–Tzid table maps Microsoft Windows time zone IDs to the standard Olson names, although such a mapping cannot be perfect because the number of time zones in Windows systems is significantly lower than in the IANA TZ database.[33]
History
[edit]The project's origins go back to 1986 or earlier.[34]
2011 lawsuit
[edit]On 30 September 2011, a lawsuit, Astrolabe, Inc. v. Olson et al., was filed concerning copyright in the database.[35][36] As a result, on 6 October 2011, the database's mailing list and FTP site were shut down.[37] The case revolved around the database maintainers' use of The American Atlas, by Thomas G. Shanks, and The International Atlas, by Thomas G. Shanks and Rique Pottenger. It complained of unauthorised reproduction of atlas data in the timezone mailing list archive and in some auxiliary link collections maintained with the database, though it did not actually point at the database itself. The complaint related only to the compilation of historical timezone data, and did not cover extant tzdata world timezone tables.[36][38][39]
This lawsuit was resolved on 22 February 2012 after the involvement of the Electronic Frontier Foundation, when Astrolabe voluntarily moved to dismiss the lawsuit without having ever served the defendants and agreed to a covenant not to sue in the future.[40]
Move to ICANN
[edit]ICANN took responsibility for the maintenance of the database on 14 October 2011.[4] The full database and a description of plans for its maintenance are available online from IANA.[41]
See also
[edit]References
[edit]- ^ a b Siroky, Evan (1 January 2024). "Time Zone Boundary Builder". GitHub.
- ^ Eggert, Paul; Olson, Arthur David. "Time zone and daylight saving time data". Archived from the original on 8 March 2021. Retrieved 23 April 2024.
- ^ Eggert, Paul (17 January 2005). "Re: FW: IANA time zone registration – proposal". tz (Mailing list).
- ^ a b "ICANN to Manage Time Zone Database" (news alert). ICANN. 15 October 2011. Archived from the original on 13 December 2014. Retrieved 30 December 2011.
- ^ Olson, Arthur David (16 December 1986). "Resolved timezone issue? Other issues. New ctime manual page". tz (Mailing list). Archived from the original on 9 March 2021. Retrieved 24 October 2018.
- ^ Eggert, Paul (20 October 1993). "proposal for time zone names". tz (Mailing list). Archived from the original on 27 September 2016. Retrieved 25 September 2016.
- ^ Olson, Arthur David (18 March 1987). "Re: List of issues". tz (Mailing list). Archived from the original on 8 March 2021. Retrieved 27 October 2018.
- ^ Devine, Bob (2 June 1988). "leap seconds; [0-60] is ok". tz (Mailing list). Archived from the original on 11 April 2016. Retrieved 18 June 2015.
- ^ "Time zone and daylight saving time data". The tz database. Retrieved 22 June 2025.
The public-domain time zone database contains code and data that represent the history of local time for many representative locations around the globe.
- ^ "Time zone and daylight saving time data". Coordinating with governments and distributors. Retrieved 22 June 2025.
There is no fixed schedule for tzdb releases. However, typically a release occurs every few months.
- ^ "Theory and pragmatics of the tz code and data". Archived from the original on 5 March 2021. Retrieved 16 December 2020.
- ^ "Scope of the tz database". Theory and pragmatics of the tz code and data. Archived from the original on 17 April 2024. Retrieved 23 April 2024.
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.
- ^ Olson, Arthur David (1 May 2010). "proposed time zone package changes (Bahia de Banderas; version naming)". tz (Mailing list). Archived from the original on 8 March 2021. Retrieved 27 October 2018.
- ^ "Timezone identifiers". Theory and pragmatics of the tz code and data. Archived from the original on 26 September 2024. Retrieved 16 December 2020.
Use only valid POSIX file name components (i.e., the parts of names other than '/'). Do not use the file name components '.' and '..'. Within a file name component, use only ASCII letters, '.', '-' and '_'. Do not use digits, as that might create an ambiguity with POSIX TZ strings. A file name component must not exceed 14 characters or start with '-'. E.g., prefer Asia/Brunei to Asia/Bandar_Seri_Begawan. Exceptions: see the discussion of legacy names below.
- ^ "Timezone identifiers". Theory and pragmatics of the tz code and data. Archived from the original on 26 September 2024. Retrieved 16 December 2020.
Keep locations compact. Use cities or small islands, not countries or regions, so that any future changes do not split individual locations into different timezones. E.g., prefer Europe/Paris to Europe/France, since France has had multiple timezones.
- ^ "Timezone identifiers". Theory and pragmatics of the tz code and data. Archived from the original on 5 March 2021. Retrieved 16 December 2020.
Here are the general guidelines used for choosing timezone names, in decreasing order of importance: ... If a name is ambiguous, use a less ambiguous alternative; e.g., many cities are named San José and Georgetown, so prefer America/Costa_Rica to America/San_Jose and America/Guyana to America/Georgetown. ... Use the most populous among locations in a region, e.g., prefer Asia/Shanghai to Asia/Beijing. Among locations with similar populations, pick the best-known location, e.g., prefer Europe/Rome to Europe/Milan.
- ^ "Timezone identifiers". Theory and pragmatics of the tz code and data. Archived from the original on 26 September 2024. Retrieved 16 December 2020.
If a name is changed, put its old spelling in the 'backward' file. This means old spellings will continue to work. Ordinarily a name change should occur only in the rare case when a location's consensus English-language spelling changes; for example, in 2008 Asia/Calcutta was renamed to Asia/Kolkata due to long-time widespread use of the new city name instead of the old.
- ^ Paul Eggert (21 December 2012). "Re: zoneinfo : ist : error". tz (Mailing list). Archived from the original on 30 May 2022. Retrieved 19 March 2013.
- ^ Olson, Arthur David (6 January 2010). "RE: little nuance in brazil 1963". tz (Mailing list). Archived from the original on 25 April 2019. Retrieved 25 April 2019.
- ^ "DST and midsummer DST in Germany until 1979". Physikalisch-Technische Bundesanstalt. 11 May 2017.
- ^ "Unicode Locale Extension ('u') for BCP 47". CLDR – Unicode Common Locale Data Repository. Archived from the original on 28 July 2011. Retrieved 18 February 2011.
- ^ "Unicode Locale Data Markup Language (LDML), Part 4: Dates". section 5, Time Zone Names. Archived from the original on 23 March 2018. Retrieved 24 March 2018.
- ^ "Olson time zone support and setup". AIX 7.3 Documentation. IBM. Retrieved 26 September 2024.
- ^ "Managing the Time Zone Variable (POSIX)". IBM. 2 February 2007. Retrieved 26 September 2024.
- ^ a b "AIX O/S updated to support 2007 Daylight Saving Time change". IBM. 18 October 2007. Archived from the original on 11 April 2016. Retrieved 12 March 2011.
- ^ "2007 daylight savings [sic] time changes for Unix". Academic Computing and Communications Center, University of Illinois at Chicago. 25 February 2007. Archived from the original on 5 August 2012. Retrieved 18 March 2008.)
- ^ Wickremasinghe, Christopher (30 March 2009). "Introduction of daylight saving time in Western Australia 2006". AIX Wiki. IBM. Archived from the original on 24 October 2012. Retrieved 11 March 2011.
- ^ "ZoneId". developer.android.com. Archived from the original on 14 September 2018. Retrieved 14 September 2018.
- ^ Release 4.0 Change Notes for the Sun Workstation (PDF). Sun Microsystems. 19 January 1987. p. 4. Archived (PDF) from the original on 7 March 2022. Retrieved 6 March 2022.
- ^ "ECMAScript 2015 Internationalization API Specification". ecma-international.org (2nd ed.). June 2015. Archived from the original on 26 October 2019. Retrieved 14 January 2020.
The ECMAScript 2015 Internationalization API Specification identifies time zones using the Zone and Link names of the IANA Time Zone Database. Their canonical form is the corresponding Zone name in the casing used in the IANA Time Zone Database. ... It is recommended that implementations use the time zone information of the IANA Time Zone Database.
- ^ "TZDB library moved to GitHub on April 23, 2014". Archived from the original on 24 February 2021. Retrieved 21 October 2015.
- ^ Oracle Database Globalization Support Guide 10g Release 1 (10.1): Chapter 4, Section "Choosing a Time Zone File". Oracle Corporation. June 2004. pp. 4–14. Part No. B10749-02. Archived from the original on 1 December 2008. Retrieved 30 October 2007.
- ^ "Windows → Tzid". Unicode Consortium. 12 November 2007. Archived from the original on 3 May 2013. Retrieved 17 February 2008.
- ^ Olson, Arthur David (24 November 1986). "seismo!elsie!tz ; new versions of time zone stuff". tz (Mailing list). Archived from the original on 26 September 2024. Retrieved 13 June 2017.
- ^ "Astrolabe, Inc. v. Olson et al". 6 October 2011. Retrieved 26 September 2024.
- ^ a b "ASTROLABE, INC., Plaintiff, v. ARTHUR DAVID OLSON and PAUL EGGERT, Defendants" (PDF). 30 September 2011. Archived from the original (PDF) on 14 March 2012. Retrieved 7 October 2011.
- ^ Olson, Arthur David (6 October 2011). "Civil suit; ftp shutdown; mailing list shutdown". tz (Mailing list). Archived from the original on 8 March 2021. Retrieved 27 October 2018.
- ^ "Time zone database shut down". The Daily Parker. 6 October 2011. Retrieved 26 September 2024.
- ^ "Time-zone database – Astrolabe's opinion". Stephen Colebourne's blog. 13 October 2011. Archived from the original on 14 October 2011. Retrieved 26 October 2011.
- ^ "EFF Wins Protection for Time Zone Database". Electronic Frontier Foundation. 22 February 2012. Archived from the original on 23 February 2012. Retrieved 22 February 2012.
- ^ "Time Zone Database". IANA. Archived from the original on 17 October 2011. Retrieved 23 November 2018.
External links
[edit]General
[edit]- Legal time (PDF), ITU, 2015.
- The tz database home page, UCLA (deprecated, see Official IANA sources below)
- The tz mailing list archive at IANA
- tz mailing list at IANA
- "A literary appreciation of the Olson/Zoneinfo/tz database" by Jon Udell
Official IANA sources
[edit]Man pages
[edit]Tz database
View on GrokipediaIntroduction
Purpose and scope
The tz database, formally known as the IANA Time Zone Database, is a public-domain compilation of rules and data for civil time across global regions, initiated in the late 1970s to standardize representations of local time for computational purposes.[1] It records the history and anticipated future of time scales, including offsets from Coordinated Universal Time (UTC) and adjustments for daylight saving time (DST), enabling software to convert between UTC and local times accurately. The scope of the tz database encompasses over 400 representative time zones, partitioning the world into regions where local clocks synchronize since the POSIX epoch of January 1, 1970.[5] This includes detailed transitions for DST observance, permanent offsets, and historical shifts due to political or legal decisions, though pre-1970 data is provided selectively for continuity in location-specific zones rather than exhaustive coverage. By focusing on verifiable civil time rules, it supports applications in diverse fields like scheduling, logging, and internationalization without relying on vendor-specific or proprietary datasets.[1] Maintained collaboratively under procedures outlined in RFC 6557, the database tracks worldwide legal changes to time observance, such as new DST policies or boundary adjustments, with releases issued multiple times annually to ensure timeliness.[1] This ongoing effort reflects its role as a neutral, authoritative resource for developers and systems integrating time zone functionality.Key concepts
In the tz database, a timezone is defined as a geographical region where civil-time clocks have synchronized their offsets from Coordinated Universal Time (UTC) and daylight saving time (DST) observance since 1970, ensuring uniform local time across the area. This includes a base UTC offset, which represents the standard difference from UTC (e.g., -5 hours for Eastern Standard Time), and DST rules that specify temporary adjustments, such as advancing clocks by one hour during designated periods to extend evening daylight.[1] These elements capture political and legal decisions on timekeeping, rather than natural solar variations, allowing software to compute accurate local times for historical and future dates within the zone. Civil time, as tracked by the tz database, refers to the legally mandated time observed in everyday life and commerce, distinct from astronomical time, which is derived from the Earth's rotation and solar position (e.g., mean solar time). The database focuses exclusively on civil time scales, incorporating adjustments like leap seconds and political changes to align with societal observance, whereas astronomical time prioritizes celestial events without regard for legal standards. This emphasis ensures that computations reflect the time people actually use, such as for scheduling or records, rather than purely scientific measurements. In tz database computations, POSIX time typically denotes a UTC-based timestamp (e.g., seconds since the Unix epoch of 1970-01-01 00:00:00 UTC), serving as a neutral, absolute reference for global synchronization. Wall time, in contrast, is the local civil time displayed on clocks in a specific timezone, incorporating the UTC offset and any active DST to produce the observable "wall clock" reading. The tz code facilitates conversions between these, enabling applications to interpret POSIX timestamps as wall times while handling ambiguities like DST transitions, where a single wall time might correspond to multiple POSIX instants. The tz database distinguishes zones as logical groupings of regions sharing identical timekeeping rules, often named after a representative city (e.g., "America/New_York" for the Eastern Time Zone), from locations, which are specific geographical points or areas mapped to those zones.[2] Zones encapsulate the abstract rules and history applicable to multiple locations, promoting consistency in software, while locations provide the concrete geographical context, such as assigning "Europe/London" to the United Kingdom's territory.[1] This separation allows the database to model complex boundaries and changes without duplicating rule sets for every minor area.Data Structure
Timezone definitions
In the tz database, a timezone is conceptually defined as a sequence of UTC offsets and associated transition rules that dictate how local time is computed for a given location over historical and future periods. This structure captures the evolution of local time, including changes due to daylight saving time (DST) and permanent adjustments to standard offsets, ensuring that the database reflects accurate timestamps from the POSIX epoch onward.[6] The database logically partitions the world into distinct timezones, where all locations within a single zone maintain identical local clock times at any given moment after 1970-01-01 00:00:00 UTC. This partitioning prioritizes regions where clocks synchronize uniformly, often aligning with political jurisdictions rather than strict geographical features, as governmental decisions govern time observance.[1] Timezone definitions include standardized abbreviations, such as EST for Eastern Standard Time or EDT for Eastern Daylight Time, to denote the local time in use during specific periods. However, these abbreviations are not unique identifiers, as the same three- or four-letter codes can apply to multiple unrelated zones (e.g., CST for Central Standard Time in North America versus China Standard Time), rendering them ambiguous for precise identification.[7] Instead, the database relies on location-based names, such as America/New_York, to unambiguously label these definitions.File formats
The tz database is distributed in multiple file formats to support both human-readable source data and efficient runtime access. The primary source files are plain text, written in a syntax processed by the zic compiler to generate binary zoneinfo files. Additionally, auxiliary files like zone.tab, zone1970.tab, and zonenow.tab provide mappings for geographical and country-based queries, with zone.tab covering general locations, zone1970.tab focusing on pre-1970 data, and zonenow.tab addressing current and predicted zones; specialized files handle historical and leap second data.[8] The source text files, such as those for individual regions (e.g., northamerica), use a structured input format for the zic compiler. These consist of Zone lines, which define timezone names, standard offsets from UTC, references to rule sets, abbreviation formats, and optional until clauses for transitions, and Rule lines, which specify daylight saving time rules including start and end years, months, days, times, and abbreviation suffixes. This syntax enables the compilation of historical and future timezone transitions into a compact representation.[9] Compiled zoneinfo files follow the Time Zone Information Format (TZif), a binary standard that supports both 32-bit and 64-bit representations. In TZif version 1, transition times are stored as 32-bit signed integers representing seconds since the POSIX epoch (1970-01-01 00:00:00 UTC), limiting the range to approximately 1901–2038; versions 2 and 3 extend this to 64-bit integers for a vastly larger temporal scope of about 292 billion years in either direction, while version 4 (as of 2024) adds optional leap-second table truncation and expiration features. Offsets from UTC and daylight saving indicators are encoded as 32-bit signed integers in seconds within local time type records, accompanied by fields for transition counts, type indices, designations (abbreviations), and leap second corrections. The format includes a fixed header with version and count fields, followed by data blocks and an optional POSIX-compatible footer in higher versions.[10] The zone.tab file serves as a tabular index mapping ISO 3166-1 alpha-2 country codes to timezone identifiers, including latitude and longitude coordinates in degrees and minutes (e.g., +404251-0740023 for 40°42'51"N 74°00'23"W) and optional comments. Each line contains four tab-separated fields: country code, coordinates, timezone name, and comments, facilitating applications that need location-based timezone lookups.[5] Pre-1970 historical data, which is less standardized and potentially less accurate, is maintained in a separate source file called backzone to isolate it from the main post-1970 coverage. Leap seconds are tracked in a dedicated leapseconds file, formatted as lines with fields for the leap occurrence date (year, month, day, time as 23:59:60 UTC), correction sign (+ for insertion), and status (S for stationary), derived from IERS bulletins. This file supports systems requiring precise UTC-to-TAI conversions but is not integrated into standard zoneinfo binaries.[8][11]Zone naming
The zone names in the tz database follow a standardized hierarchical format ofAREA/LOCATION, where AREA typically denotes a continent, ocean, or broad region (such as America for both North and South America, Africa, Asia, Europe, Atlantic, Indian, Pacific, Australia, Antarctica, or Arctic), and LOCATION specifies a city or other representative place within that area.[8] This convention, designed by Paul Eggert, ensures that each name uniquely identifies a timezone applicable since 1970, when coordinated universal time became prevalent, while indicating a typical location of clocks observing that timezone for expert users.[8]
The selection of names adheres to specific criteria to promote stability and neutrality: they must be robust against political changes by avoiding direct ties to country names, comply with POSIX filename rules (using only ASCII letters, periods, hyphens, underscores, limited to 14 characters without digits or leading hyphens), and prioritize compact, populous, and well-known locations—often the largest city in the zone—to serve as stable representatives.[8] For instance, America/New_York is chosen over other U.S. Eastern Time cities due to New York's prominence, and Asia/Shanghai represents China Standard Time rather than the capital Beijing for its larger population and historical significance.[8] These guidelines evolved from earlier rules, such as requiring at least one name per ISO 3166-1 country code, which were abandoned to better accommodate complex regional variations.[8]
Special cases include the Etc/ area for fixed-offset zones and UTC variants, defined in the etcetera source file to support platforms requiring leap second information or simple offsets like Etc/UTC and Etc/GMT (noting that GMT here denotes a fixed offset, not Greenwich Mean Time).[8] Backward compatibility is maintained through the backward source file, which creates symbolic links from obsolete names (e.g., US/Eastern or Asia/Calcutta) to current ones (e.g., America/New_York or Asia/Kolkata, renamed in 2008 to reflect official spelling changes), ensuring legacy software continues to function without disruption.[8] Name changes are rare and occur only when necessary, such as for accuracy or geopolitical updates, with old aliases preserved indefinitely.[8]
DST rules
In the tz database, daylight saving time (DST) transitions are defined using Rule lines in the source files, which specify the start and end dates, times, and offsets for advancing or setting back clocks from standard time. These rules enable the database to model periods of DST observance, where local time is typically shifted forward by one hour (or sometimes more) during warmer months to conserve energy or align with social patterns. Each Rule line applies to a contiguous range of years and can represent either the onset of DST (spring-forward) or its cessation (fall-back), with the SAVE field indicating the offset from standard time, such as +1:00 for a one-hour advance.[8] The structure of a Rule line is: Rule <NAME> <FROM> <TO> <TYPE> <IN> <ON> <AT> <SAVE> <LETTER>/<S>, where <NAME> identifies the rule set (e.g., US for United States rules), <FROM> and <TO> delimit the applicable years (e.g., 1987 or max for ongoing), <TYPE> is typically a hyphen, <IN> specifies the month (e.g., Mar), <ON> defines the day (e.g., lastSun or 15), <AT> sets the transition time (e.g., 2:00), <SAVE> denotes the time shift, and <LETTER> provides the abbreviation suffix (e.g., D for DST). Rule sets consist of one or more such lines to cover historical and predicted changes, allowing for complex patterns like double DST or wartime adjustments.[8] DST rules fall into several types based on recurrence: annual patterns using relative day specifiers like lastSun in a given month for recurring transitions (e.g., the last Sunday of October); fixed-date rules for one-off or periodic exact dates (e.g., Sep 30); or no rules at all for zones without DST, indicated by a zero offset in the Zone file. For instance, a syntax example for a recurring DST start might appear as Rule EU 1996 max - Mar lastSun 1:00u 1:00 D, specifying a UTC-based time to precisely define the shift. These types accommodate diverse global practices, from biannual shifts in North America to year-round DST in some regions.[8] Transition times are computed relative to local wall clock time by default, meaning the specified hour (e.g., 2:00) refers to the time as shown on clocks before the change, but a 'u' suffix (e.g., 2:00u) interprets it in UTC to ensure consistency across zones. This distinction is crucial for handling ambiguities during fall-back transitions, where clocks retreat (e.g., from 3:00 DST to 2:00 standard), creating a one-hour period that occurs twice; the database resolves this by applying the transition to the earlier wall-clock instance, treating later duplicates as post-transition standard time until the next change. Spring-forward transitions avoid such overlaps but skip the advanced hour entirely.[8] Rules are often shared rather than duplicated, with Zone entries referencing a rule name in their RULES field (e.g., -5:00 US E%sT) to apply the same DST logic across multiple locations, promoting consistency for regions like the European Union or Australia that follow unified policies. This referencing mechanism supports the database's goal of covering over 400 zones while minimizing redundancy in DST specifications.[8]Example entries
To illustrate the structure of the tz database, consider the Zone entry for America/New_York, which represents the Eastern Time Zone in the United States and Canada. A representative Zone line from the source files is:Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03:58 -5:00 US E%sT. This defines the initial local mean time (LMT) offset of -4:56:02 until November 18, 1883, at 12:03:58 universal time, after which it adopts a -5:00 standard offset (Eastern Standard Time, EST) and applies US-specific rules for transitions, formatting as EST or EDT (Eastern Daylight Time).[12]
Complementing this, Rule lines specify daylight saving time (DST) transitions. For the period from 1967 to 2006, key US rules include: Rule US 1967 2006 - Oct lastSun 2:00 0 S for ending DST on the last Sunday in October at 2:00 standard time (saving 0 hours, letter S for standard), and Rule US 1967 1973 - Apr lastSun 2:00 1:00 D for starting DST on the last Sunday in April at 2:00 standard time (saving 1 hour, letter D for daylight). Later refinements, such as Rule US 1987 2006 - Apr Sun>=1 2:00 1:00 D, adjusted the spring transition to the first Sunday on or after April 1. These rules link to the Zone entry via the "US" reference, dictating when offsets shift between -5:00 (EST) and -4:00 (EDT).[12]
The zic compiler processes these Zone and Rule lines into binary zoneinfo files, compiling them into a sequence of transitions represented as timestamps (in UTC) with associated offsets, abbreviations, and DST indicators. For America/New_York, this results in discrete entries for each historical change, such as the 1967-04-30 06:00 UTC transition to EDT (corresponding to 2:00 local standard time on the last Sunday in April). The binary format stores these as an array of transition times followed by type descriptors (offset, DST flag, abbreviation index), enabling efficient lookups for any given date without recalculating rules.[12][13]
Examples like these highlight significant policy shifts, such as the 2007 US DST extension under the Energy Policy Act of 2005, which advanced the start to the second Sunday in March (Rule US 2007 max - Mar Sun>=8 2:00 1:00 D) and delayed the end to the first Sunday in November (Rule US 2007 max - Nov Sun>=1 2:00 0 S), adding about a month of DST annually and requiring tz database updates to reflect the new transitions in affected zones.[12][14]