theory.html revision 1.21
11.4Schristos<!DOCTYPE html> 21.1Schristos<html lang="en"> 31.1Schristos<head> 41.1Schristos <title>Theory and pragmatics of the tz code and data</title> 51.1Schristos <meta charset="UTF-8"> 61.4Schristos <style> 71.4Schristos pre {margin-left: 2em; white-space: pre-wrap;} 81.4Schristos </style> 91.1Schristos</head> 101.1Schristos 111.1Schristos<body> 121.3Schristos<h1>Theory and pragmatics of the <code><abbr>tz</abbr></code> code and data</h1> 131.1Schristos <h3>Outline</h3> 141.1Schristos <nav> 151.1Schristos <ul> 161.3Schristos <li><a href="#scope">Scope of the <code><abbr>tz</abbr></code> 171.3Schristos database</a></li> 181.7Schristos <li><a href="#naming">Timezone identifiers</a></li> 191.1Schristos <li><a href="#abbreviations">Time zone abbreviations</a></li> 201.3Schristos <li><a href="#accuracy">Accuracy of the <code><abbr>tz</abbr></code> 211.3Schristos database</a></li> 221.1Schristos <li><a href="#functions">Time and date functions</a></li> 231.1Schristos <li><a href="#stability">Interface stability</a></li> 241.9Schristos <li><a href="#leapsec">Leap seconds</a></li> 251.1Schristos <li><a href="#calendar">Calendrical issues</a></li> 261.18Schristos <li><a href="#planets">Time and time zones off earth</a></li> 271.1Schristos </ul> 281.1Schristos </nav> 291.1Schristos 301.3Schristos<section> 311.3Schristos <h2 id="scope">Scope of the <code><abbr>tz</abbr></code> database</h2> 321.1Schristos<p> 331.3SchristosThe <a 341.3Schristoshref="https://www.iana.org/time-zones"><code><abbr>tz</abbr></code> 351.3Schristosdatabase</a> attempts to record the history and predicted future of 361.10Schristoscivil time scales. 371.3SchristosIt organizes <a href="tz-link.html">time zone and daylight saving time 381.3Schristosdata</a> by partitioning the world into <a 391.4Schristoshref="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><dfn>timezones</dfn></a> 401.3Schristoswhose clocks all agree about timestamps that occur after the <a 411.3Schristoshref="https://en.wikipedia.org/wiki/Unix_time">POSIX Epoch</a> 421.3Schristos(1970-01-01 00:00:00 <a 431.3Schristoshref="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr 441.3Schristostitle="Coordinated Universal Time">UTC</abbr></a>). 451.3SchristosAlthough 1970 is a somewhat-arbitrary cutoff, there are significant 461.3Schristoschallenges to moving the cutoff earlier even by a decade or two, due 471.3Schristosto the wide variety of local practices before computer timekeeping 481.3Schristosbecame prevalent. 491.12SchristosMost timezones correspond to a notable location and the database 501.12Schristosrecords all known clock transitions for that location; 511.12Schristossome timezones correspond instead to a fixed <abbr>UTC</abbr> offset. 521.1Schristos</p> 531.1Schristos 541.1Schristos<p> 551.4SchristosEach timezone typically corresponds to a geographical region that is 561.4Schristossmaller than a traditional time zone, because clocks in a timezone 571.4Schristosall agree after 1970 whereas a traditional time zone merely 581.4Schristosspecifies current standard time. For example, applications that deal 591.4Schristoswith current and future timestamps in the traditional North 601.4SchristosAmerican mountain time zone can choose from the timezones 611.4Schristos<code>America/Denver</code> which observes US-style daylight saving 621.12Schristostime (<abbr>DST</abbr>), 631.12Schristosand <code>America/Phoenix</code> which does not observe <abbr>DST</abbr>. 641.4SchristosApplications that also deal with past timestamps in the mountain time 651.4Schristoszone can choose from over a dozen timezones, such as 661.4Schristos<code>America/Boise</code>, <code>America/Edmonton</code>, and 671.4Schristos<code>America/Hermosillo</code>, each of which currently uses mountain 681.4Schristostime but differs from other timezones for some timestamps after 1970. 691.4Schristos</p> 701.4Schristos 711.4Schristos<p> 721.12SchristosClock transitions before 1970 are recorded for location-based timezones, 731.1Schristosbecause most systems support timestamps before 1970 and could 741.1Schristosmisbehave if data entries were omitted for pre-1970 transitions. 751.1SchristosHowever, the database is not designed for and does not suffice for 761.1Schristosapplications requiring accurate handling of all past times everywhere, 771.1Schristosas it would take far too much effort and guesswork to record all 781.1Schristosdetails of pre-1970 civil timekeeping. 791.3SchristosAlthough some information outside the scope of the database is 801.2Schristoscollected in a file <code>backzone</code> that is distributed along 811.2Schristoswith the database proper, this file is less reliable and does not 821.2Schristosnecessarily follow database guidelines. 831.1Schristos</p> 841.1Schristos 851.1Schristos<p> 861.3SchristosAs described below, reference source code for using the 871.3Schristos<code><abbr>tz</abbr></code> database is also available. 881.3SchristosThe <code><abbr>tz</abbr></code> code is upwards compatible with <a 891.3Schristoshref="https://en.wikipedia.org/wiki/POSIX">POSIX</a>, an international 901.3Schristosstandard for <a 911.3Schristoshref="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems. 921.20SchristosAs of this writing, the current edition of POSIX is POSIX.1-2024, 931.20Schristoswhich has been published but not yet in HTML form. 941.20SchristosUnlike its predecessor POSIX.1-2017 (<a 951.8Schristoshref="https://pubs.opengroup.org/onlinepubs/9699919799/"> The Open 961.3SchristosGroup Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018 971.20SchristosEdition), POSIX.1-2024 requires support for the 981.20Schristos<code><abbr>tz</abbr></code> database, which has a 991.20Schristosmodel for describing civil time that is more complex than the 1001.20Schristosstandard and daylight saving times required by POSIX.1-2017. 1011.4SchristosA <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can 1021.3Schristoshave more than two changes per year, these changes need not merely 1031.3Schristosflip back and forth between two alternatives, and the rules themselves 1041.3Schristoscan change at times. 1051.9SchristosWhether and when a timezone changes its clock, 1061.9Schristosand even the timezone's notional base offset from <abbr>UTC</abbr>, 1071.9Schristosare variable. 1081.4SchristosIt does not always make sense to talk about a timezone's 1091.4Schristos"base offset", which is not necessarily a single number. 1101.1Schristos</p> 1111.1Schristos 1121.3Schristos</section> 1131.1Schristos 1141.3Schristos<section> 1151.7Schristos <h2 id="naming">Timezone identifiers</h2> 1161.1Schristos<p> 1171.7SchristosEach timezone has a name that uniquely identifies the timezone. 1181.1SchristosInexperienced users are not expected to select these names unaided. 1191.1SchristosDistributors should provide documentation and/or a simple selection 1201.4Schristosinterface that explains each name via a map or via descriptive text like 1211.10Schristos"Czech Republic" instead of the timezone name "<code>Europe/Prague</code>". 1221.4SchristosIf geolocation information is available, a selection interface can 1231.4Schristoslocate the user on a timezone map or prioritize names that are 1241.4Schristosgeographically close. For an example selection interface, see the 1251.3Schristos<code>tzselect</code> program in the <code><abbr>tz</abbr></code> code. 1261.21SchristosUnicode's <a href="https://cldr.unicode.org">Common Locale Data 1271.21SchristosRepository (<abbr>CLDR</abbr>)</a> 1281.21Schristoscontains data that may be useful for other selection 1291.10Schristosinterfaces; it maps timezone names like <code>Europe/Prague</code> to 1301.10Schristoslocale-dependent strings like "Prague", "Praha", "Прага", and "布拉格". 1311.1Schristos</p> 1321.1Schristos 1331.1Schristos<p> 1341.3SchristosThe naming conventions attempt to strike a balance 1351.1Schristosamong the following goals: 1361.1Schristos</p> 1371.3Schristos 1381.1Schristos<ul> 1391.1Schristos <li> 1401.4Schristos Uniquely identify every timezone where clocks have agreed since 1970. 1411.3Schristos This is essential for the intended use: static clocks keeping local 1421.3Schristos civil time. 1431.1Schristos </li> 1441.1Schristos <li> 1451.4Schristos Indicate to experts where the timezone's clocks typically are. 1461.1Schristos </li> 1471.1Schristos <li> 1481.3Schristos Be robust in the presence of political changes. 1491.7Schristos For example, names are typically not tied to countries, to avoid 1501.3Schristos incompatibilities when countries change their name (e.g., 1511.7Schristos Swaziland→Eswatini) or when locations change countries (e.g., Hong 1521.3Schristos Kong from UK colony to China). 1531.7Schristos There is no requirement that every country or national 1541.7Schristos capital must have a timezone name. 1551.1Schristos </li> 1561.1Schristos <li> 1571.3Schristos Be portable to a wide variety of implementations. 1581.1Schristos </li> 1591.1Schristos <li> 1601.3Schristos Use a consistent naming conventions over the entire world. 1611.1Schristos </li> 1621.1Schristos</ul> 1631.3Schristos 1641.1Schristos<p> 1651.20SchristosNames normally have the format 1661.3Schristos<var>AREA</var><code>/</code><var>LOCATION</var>, where 1671.4Schristos<var>AREA</var> is a continent or ocean, and 1681.4Schristos<var>LOCATION</var> is a specific location within the area. 1691.3SchristosNorth and South America share the same area, '<code>America</code>'. 1701.3SchristosTypical names are '<code>Africa/Cairo</code>', 1711.3Schristos'<code>America/New_York</code>', and '<code>Pacific/Honolulu</code>'. 1721.3SchristosSome names are further qualified to help avoid confusion; for example, 1731.3Schristos'<code>America/Indiana/Petersburg</code>' distinguishes Petersburg, 1741.3SchristosIndiana from other Petersburgs in America. 1751.1Schristos</p> 1761.1Schristos 1771.1Schristos<p> 1781.3SchristosHere are the general guidelines used for 1791.4Schristoschoosing timezone names, 1801.1Schristosin decreasing order of importance: 1811.1Schristos</p> 1821.3Schristos 1831.1Schristos<ul> 1841.1Schristos <li> 1851.3Schristos Use only valid POSIX file name components (i.e., the parts of 1861.3Schristos names other than '<code>/</code>'). 1871.3Schristos Do not use the file name components '<code>.</code>' and 1881.3Schristos '<code>..</code>'. 1891.3Schristos Within a file name component, use only <a 1901.3Schristos href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters, 1911.3Schristos '<code>.</code>', '<code>-</code>' and '<code>_</code>'. 1921.3Schristos Do not use digits, as that might create an ambiguity with <a 1931.20Schristos href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX's proleptic 1941.3Schristos <code>TZ</code> strings</a>. 1951.3Schristos A file name component must not exceed 14 characters or start with 1961.3Schristos '<code>-</code>'. 1971.12Schristos E.g., prefer <code>America/Noronha</code> to 1981.12Schristos <code>America/Fernando_de_Noronha</code>. 1991.3Schristos Exceptions: see the discussion of legacy names below. 2001.1Schristos </li> 2011.1Schristos <li> 2021.3Schristos A name must not be empty, or contain '<code>//</code>', or 2031.3Schristos start or end with '<code>/</code>'. 2041.21Schristos Also, a name must not be '<code>Etc/Unknown</code>', as 2051.21Schristos <abbr>CLDR</abbr> uses that string for an unknown or invalid timezone. 2061.1Schristos </li> 2071.1Schristos <li> 2081.3Schristos Do not use names that differ only in case. 2091.3Schristos Although the reference implementation is case-sensitive, some 2101.3Schristos other implementations are not, and they would mishandle names 2111.3Schristos differing only in case. 2121.1Schristos </li> 2131.1Schristos <li> 2141.3Schristos If one name <var>A</var> is an initial prefix of another 2151.3Schristos name <var>AB</var> (ignoring case), then <var>B</var> must not 2161.3Schristos start with '<code>/</code>', as a regular file cannot have the 2171.3Schristos same name as a directory in POSIX. 2181.3Schristos For example, <code>America/New_York</code> precludes 2191.3Schristos <code>America/New_York/Bronx</code>. 2201.1Schristos </li> 2211.1Schristos <li> 2221.3Schristos Uninhabited regions like the North Pole and Bouvet Island 2231.3Schristos do not need locations, since local time is not defined there. 2241.1Schristos </li> 2251.1Schristos <li> 2261.21Schristos If all clocks in a region have agreed since 1970, 2271.21Schristos give them just one name even if some of the clocks disagreed before 1970, 2281.21Schristos or reside in different countries or in notable or faraway locations. 2291.3Schristos Otherwise these tables would become annoyingly large. 2301.21Schristos For example, do not create a name <code>Indian/Crozet</code> 2311.21Schristos as a near-duplicate or alias of <code>Asia/Dubai</code> 2321.21Schristos merely because they are different countries or territories, 2331.21Schristos or their clocks disagreed before 1970, or the 2341.21Schristos <a href="https://en.wikipedia.org/wiki/Crozet_Islands">Crozet Islands</a> 2351.21Schristos are notable in their own right, 2361.21Schristos or the Crozet Islands are not adjacent to other locations 2371.21Schristos that use <code>Asia/Dubai</code>. 2381.1Schristos </li> 2391.1Schristos <li> 2401.7Schristos If boundaries between regions are fluid, such as during a war or 2411.7Schristos insurrection, do not bother to create a new timezone merely 2421.7Schristos because of yet another boundary change. This helps prevent table 2431.7Schristos bloat and simplifies maintenance. 2441.7Schristos </li> 2451.7Schristos <li> 2461.3Schristos If a name is ambiguous, use a less ambiguous alternative; 2471.3Schristos e.g., many cities are named San José and Georgetown, so 2481.3Schristos prefer <code>America/Costa_Rica</code> to 2491.3Schristos <code>America/San_Jose</code> and <code>America/Guyana</code> 2501.3Schristos to <code>America/Georgetown</code>. 2511.1Schristos </li> 2521.1Schristos <li> 2531.3Schristos Keep locations compact. 2541.3Schristos Use cities or small islands, not countries or regions, so that any 2551.3Schristos future changes do not split individual locations into different 2561.4Schristos timezones. 2571.3Schristos E.g., prefer <code>Europe/Paris</code> to <code>Europe/France</code>, 2581.3Schristos since 2591.3Schristos <a href="https://en.wikipedia.org/wiki/Time_in_France#History">France 2601.3Schristos has had multiple time zones</a>. 2611.1Schristos </li> 2621.1Schristos <li> 2631.3Schristos Use mainstream English spelling, e.g., prefer 2641.4Schristos <code>Europe/Rome</code> to <code>Europa/Roma</code>, and 2651.3Schristos prefer <code>Europe/Athens</code> to the Greek 2661.4Schristos <code>Ευρώπη/Αθήνα</code> or the Romanized 2671.4Schristos <code>Evrópi/Athína</code>. 2681.3Schristos The POSIX file name restrictions encourage this guideline. 2691.1Schristos </li> 2701.1Schristos <li> 2711.3Schristos Use the most populous among locations in a region, 2721.3Schristos e.g., prefer <code>Asia/Shanghai</code> to 2731.3Schristos <code>Asia/Beijing</code>. 2741.3Schristos Among locations with similar populations, pick the best-known 2751.3Schristos location, e.g., prefer <code>Europe/Rome</code> to 2761.3Schristos <code>Europe/Milan</code>. 2771.1Schristos </li> 2781.1Schristos <li> 2791.3Schristos Use the singular form, e.g., prefer <code>Atlantic/Canary</code> to 2801.3Schristos <code>Atlantic/Canaries</code>. 2811.1Schristos </li> 2821.1Schristos <li> 2831.3Schristos Omit common suffixes like '<code>_Islands</code>' and 2841.3Schristos '<code>_City</code>', unless that would lead to ambiguity. 2851.3Schristos E.g., prefer <code>America/Cayman</code> to 2861.3Schristos <code>America/Cayman_Islands</code> and 2871.3Schristos <code>America/Guatemala</code> to 2881.3Schristos <code>America/Guatemala_City</code>, but prefer 2891.3Schristos <code>America/Mexico_City</code> to 2901.3Schristos <code>America/Mexico</code> 2911.3Schristos because <a href="https://en.wikipedia.org/wiki/Time_in_Mexico">the 2921.3Schristos country of Mexico has several time zones</a>. 2931.1Schristos </li> 2941.1Schristos <li> 2951.3Schristos Use '<code>_</code>' to represent a space. 2961.1Schristos </li> 2971.1Schristos <li> 2981.3Schristos Omit '<code>.</code>' from abbreviations in names. 2991.3Schristos E.g., prefer <code>Atlantic/St_Helena</code> to 3001.3Schristos <code>Atlantic/St._Helena</code>. 3011.1Schristos </li> 3021.1Schristos <li> 3031.3Schristos Do not change established names if they only marginally violate 3041.3Schristos the above guidelines. 3051.3Schristos For example, do not change the existing name <code>Europe/Rome</code> to 3061.3Schristos <code>Europe/Milan</code> merely because Milan's population has grown 3071.3Schristos to be somewhat greater than Rome's. 3081.1Schristos </li> 3091.1Schristos <li> 3101.3Schristos If a name is changed, put its old spelling in the 3111.13Schristos '<code>backward</code>' file as a link to the new spelling. 3121.3Schristos This means old spellings will continue to work. 3131.9Schristos Ordinarily a name change should occur only in the rare case when 3141.9Schristos a location's consensus English-language spelling changes; for example, 3151.9Schristos in 2008 <code>Asia/Calcutta</code> was renamed to <code>Asia/Kolkata</code> 3161.9Schristos due to long-time widespread use of the new city name instead of the old. 3171.1Schristos </li> 3181.1Schristos</ul> 3191.1Schristos 3201.1Schristos<p> 3211.7SchristosGuidelines have evolved with time, and names following old versions of 3221.8Schristosthese guidelines might not follow the current version. When guidelines 3231.7Schristoshave changed, old names continue to be supported. Guideline changes 3241.7Schristoshave included the following: 3251.1Schristos</p> 3261.1Schristos 3271.7Schristos<ul> 3281.7Schristos<li> 3291.7SchristosOlder versions of this package used a different naming scheme. 3301.1SchristosSee the file '<code>backward</code>' for most of these older names 3311.1Schristos(e.g., '<code>US/Eastern</code>' instead of '<code>America/New_York</code>'). 3321.1SchristosThe other old-fashioned names still supported are 3331.3Schristos'<code>WET</code>', '<code>CET</code>', '<code>MET</code>', and 3341.3Schristos'<code>EET</code>' (see the file '<code>europe</code>'). 3351.7Schristos</li> 3361.1Schristos 3371.7Schristos<li> 3381.1SchristosOlder versions of this package defined legacy names that are 3391.3Schristosincompatible with the first guideline of location names, but which are 3401.3Schristosstill supported. 3411.3SchristosThese legacy names are mostly defined in the file 3421.3Schristos'<code>etcetera</code>'. 3431.3SchristosAlso, the file '<code>backward</code>' defines the legacy names 3441.16Schristos'<code>Etc/GMT0</code>', '<code>Etc/GMT-0</code>', '<code>Etc/GMT+0</code>', 3451.3Schristos'<code>GMT0</code>', '<code>GMT-0</code>' and '<code>GMT+0</code>', 3461.3Schristosand the file '<code>northamerica</code>' defines the legacy names 3471.3Schristos'<code>EST5EDT</code>', '<code>CST6CDT</code>', 3481.3Schristos'<code>MST7MDT</code>', and '<code>PST8PDT</code>'. 3491.7Schristos</li> 3501.7Schristos 3511.7Schristos<li> 3521.8SchristosOlder versions of these guidelines said that 3531.7Schristosthere should typically be at least one name for each <a 3541.7Schristoshref="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr 3551.7Schristostitle="International Organization for Standardization">ISO</abbr> 3561.7Schristos3166-1</a> officially assigned two-letter code for an inhabited 3571.7Schristoscountry or territory. 3581.7SchristosThis old guideline has been dropped, as it was not needed to handle 3591.7Schristostimestamps correctly and it increased maintenance burden. 3601.7Schristos</li> 3611.7Schristos</ul> 3621.7Schristos 3631.7Schristos<p> 3641.13SchristosThe file <code>zone1970.tab</code> lists geographical locations used 3651.7Schristosto name timezones. 3661.7SchristosIt is intended to be an exhaustive list of names for geographic 3671.7Schristosregions as described above; this is a subset of the timezones in the data. 3681.13SchristosAlthough a <code>zone1970.tab</code> location's 3691.7Schristos<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a> 3701.7Schristoscorresponds to 3711.7Schristosits <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean 3721.7Schristostime (<abbr>LMT</abbr>)</a> offset with one hour for every 15° 3731.7Schristoseast longitude, this relationship is not exact. 3741.13SchristosThe backward-compatibility file <code>zone.tab</code> is similar 3751.13Schristosbut conforms to the older-version guidelines related to <abbr>ISO</abbr> 3166-1; 3761.13Schristosit lists only one country code per entry and unlike <code>zone1970.tab</code> 3771.13Schristosit can list names defined in <code>backward</code>. 3781.19SchristosApplications that process only timestamps from now on can instead use the file 3791.19Schristos<code>zonenow.tab</code>, which partitions the world more coarsely, 3801.19Schristosinto regions where clocks agree now and in the predicted future; 3811.19Schristosthis file is smaller and simpler than <code>zone1970.tab</code> 3821.19Schristosand <code>zone.tab</code>. 3831.1Schristos</p> 3841.1Schristos 3851.1Schristos<p> 3861.13SchristosThe database defines each timezone name to be a zone, or a link to a zone. 3871.13SchristosThe source file <code>backward</code> defines links for backward 3881.13Schristoscompatibility; it does not define zones. 3891.13SchristosAlthough <code>backward</code> was originally designed to be optional, 3901.13Schristosnowadays distributions typically use it 3911.13Schristosand no great weight should be attached to whether a link 3921.13Schristosis defined in <code>backward</code> or in some other file. 3931.13SchristosThe source file <code>etcetera</code> defines names that may be useful 3941.20Schristoson platforms that do not support proleptic <code>TZ</code> strings 3951.20Schristoslike <code><+08>-8</code>; 3961.13Schristosno other source file other than <code>backward</code> 3971.13Schristoscontains links to its zones. 3981.14SchristosOne of <code>etcetera</code>'s names is <code>Etc/UTC</code>, 3991.13Schristosused by functions like <code>gmtime</code> to obtain leap 4001.13Schristossecond information on platforms that support leap seconds. 4011.14SchristosAnother <code>etcetera</code> name, <code>GMT</code>, 4021.14Schristosis used by older code releases. 4031.1Schristos</p> 4041.3Schristos</section> 4051.1Schristos 4061.3Schristos<section> 4071.3Schristos <h2 id="abbreviations">Time zone abbreviations</h2> 4081.1Schristos<p> 4091.1SchristosWhen this package is installed, it generates time zone abbreviations 4101.1Schristoslike '<code>EST</code>' to be compatible with human tradition and POSIX. 4111.3SchristosHere are the general guidelines used for choosing time zone abbreviations, 4121.1Schristosin decreasing order of importance: 4131.3Schristos</p> 4141.3Schristos 4151.1Schristos<ul> 4161.1Schristos <li> 4171.3Schristos Use three to six characters that are ASCII alphanumerics or 4181.3Schristos '<code>+</code>' or '<code>-</code>'. 4191.3Schristos Previous editions of this database also used characters like 4201.3Schristos space and '<code>?</code>', but these characters have a 4211.3Schristos special meaning to the 4221.3Schristos <a href="https://en.wikipedia.org/wiki/Unix_shell">UNIX shell</a> 4231.3Schristos and cause commands like 4241.8Schristos '<code><a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a> 4251.8Schristos `<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>' 4261.3Schristos to have unexpected effects. 4271.3Schristos Previous editions of this guideline required upper-case letters, but the 4281.3Schristos Congressman who introduced 4291.3Schristos <a href="https://en.wikipedia.org/wiki/Chamorro_Time_Zone">Chamorro 4301.3Schristos Standard Time</a> preferred "ChST", so lower-case letters are now 4311.3Schristos allowed. 4321.3Schristos Also, POSIX from 2001 on relaxed the rule to allow '<code>-</code>', 4331.3Schristos '<code>+</code>', and alphanumeric characters from the portable 4341.3Schristos character set in the current locale. 4351.3Schristos In practice ASCII alphanumerics and '<code>+</code>' and 4361.3Schristos '<code>-</code>' are safe in all locales. 4371.3Schristos 4381.3Schristos <p> 4391.3Schristos In other words, in the C locale the POSIX extended regular 4401.3Schristos expression <code>[-+[:alnum:]]{3,6}</code> should match the 4411.3Schristos abbreviation. 4421.20Schristos This guarantees that all abbreviations could have been specified 4431.20Schristos explicitly by a POSIX proleptic <code>TZ</code> string. 4441.3Schristos </p> 4451.3Schristos </li> 4461.3Schristos <li> 4471.3Schristos Use abbreviations that are in common use among English-speakers, 4481.3Schristos e.g., 'EST' for Eastern Standard Time in North America. 4491.3Schristos We assume that applications translate them to other languages 4501.3Schristos as part of the normal localization process; for example, 4511.3Schristos a French application might translate 'EST' to 'HNE'. 4521.3Schristos 4531.3Schristos <p> 4541.3Schristos <small>These abbreviations (for standard/daylight/etc. time) are: 4551.3Schristos ACST/ACDT Australian Central, 4561.3Schristos AST/ADT/APT/AWT/ADDT Atlantic, 4571.3Schristos AEST/AEDT Australian Eastern, 4581.3Schristos AHST/AHDT Alaska-Hawaii, 4591.3Schristos AKST/AKDT Alaska, 4601.3Schristos AWST/AWDT Australian Western, 4611.3Schristos BST/BDT Bering, 4621.3Schristos CAT/CAST Central Africa, 4631.3Schristos CET/CEST/CEMT Central European, 4641.3Schristos ChST Chamorro, 4651.18Schristos CST/CDT/CWT/CPT Central [North America], 4661.3Schristos CST/CDT China, 4671.3Schristos GMT/BST/IST/BDST Greenwich, 4681.3Schristos EAT East Africa, 4691.18Schristos EST/EDT/EWT/EPT Eastern [North America], 4701.3Schristos EET/EEST Eastern European, 4711.6Schristos GST/GDT Guam, 4721.5Schristos HST/HDT/HWT/HPT Hawaii, 4731.9Schristos HKT/HKST/HKWT Hong Kong, 4741.3Schristos IST India, 4751.3Schristos IST/GMT Irish, 4761.3Schristos IST/IDT/IDDT Israel, 4771.3Schristos JST/JDT Japan, 4781.3Schristos KST/KDT Korea, 4791.3Schristos MET/MEST Middle European (a backward-compatibility alias for 4801.3Schristos Central European), 4811.3Schristos MSK/MSD Moscow, 4821.18Schristos MST/MDT/MWT/MPT Mountain, 4831.3Schristos NST/NDT/NWT/NPT/NDDT Newfoundland, 4841.3Schristos NST/NDT/NWT/NPT Nome, 4851.3Schristos NZMT/NZST New Zealand through 1945, 4861.3Schristos NZST/NZDT New Zealand 1946–present, 4871.3Schristos PKT/PKST Pakistan, 4881.18Schristos PST/PDT/PWT/PPT Pacific, 4891.4Schristos PST/PDT Philippine, 4901.3Schristos SAST South Africa, 4911.3Schristos SST Samoa, 4921.14Schristos UTC Universal, 4931.3Schristos WAT/WAST West Africa, 4941.3Schristos WET/WEST/WEMT Western European, 4951.3Schristos WIB Waktu Indonesia Barat, 4961.3Schristos WIT Waktu Indonesia Timur, 4971.3Schristos WITA Waktu Indonesia Tengah, 4981.3Schristos YST/YDT/YWT/YPT/YDDT Yukon</small>. 4991.3Schristos </p> 5001.3Schristos </li> 5011.3Schristos <li> 5021.3Schristos <p> 5031.3Schristos For times taken from a city's longitude, use the 5041.3Schristos traditional <var>x</var>MT notation. 5051.3Schristos The only abbreviation like this in current use is '<abbr>GMT</abbr>'. 5061.3Schristos The others are for timestamps before 1960, 5071.3Schristos except that Monrovia Mean Time persisted until 1972. 5081.3Schristos Typically, numeric abbreviations (e.g., '<code>-</code>004430' for 5091.3Schristos MMT) would cause trouble here, as the numeric strings would exceed 5101.3Schristos the POSIX length limit. 5111.3Schristos </p> 5121.3Schristos 5131.3Schristos <p> 5141.3Schristos <small>These abbreviations are: 5151.12Schristos AMT Asunción, Athens; 5161.18Schristos BMT Baghdad, Bangkok, Batavia, Bermuda, Bern, Bogotá, 5171.11Schristos Brussels, Bucharest; 5181.12Schristos CMT Calamarca, Caracas, Chisinau, Colón, Córdoba; 5191.3Schristos DMT Dublin/Dunsink; 5201.3Schristos EMT Easter; 5211.3Schristos FFMT Fort-de-France; 5221.3Schristos FMT Funchal; 5231.3Schristos GMT Greenwich; 5241.3Schristos HMT Havana, Helsinki, Horta, Howrah; 5251.3Schristos IMT Irkutsk, Istanbul; 5261.3Schristos JMT Jerusalem; 5271.14Schristos KMT Kaunas, Kyiv, Kingston; 5281.18Schristos LMT Lima, Lisbon, local; 5291.3Schristos MMT Macassar, Madras, Malé, Managua, Minsk, Monrovia, Montevideo, 5301.3Schristos Moratuwa, Moscow; 5311.3Schristos PLMT Phù Liễn; 5321.3Schristos PMT Paramaribo, Paris, Perm, Pontianak, Prague; 5331.3Schristos PMMT Port Moresby; 5341.18Schristos PPMT Port-au-Prince; 5351.3Schristos QMT Quito; 5361.3Schristos RMT Rangoon, Riga, Rome; 5371.3Schristos SDMT Santo Domingo; 5381.3Schristos SJMT San José; 5391.3Schristos SMT Santiago, Simferopol, Singapore, Stanley; 5401.3Schristos TBMT Tbilisi; 5411.3Schristos TMT Tallinn, Tehran; 5421.18Schristos WMT Warsaw.</small> 5431.3Schristos </p> 5441.3Schristos 5451.3Schristos <p> 5461.3Schristos <small>A few abbreviations also follow the pattern that 5471.4Schristos <abbr>GMT</abbr>/<abbr>BST</abbr> established for time in the UK. 5481.3Schristos They are: 5491.11Schristos BMT/BST for Bermuda 1890–1930, 5501.3Schristos CMT/BST for Calamarca Mean Time and Bolivian Summer Time 5511.3Schristos 1890–1932, 5521.3Schristos DMT/IST for Dublin/Dunsink Mean Time and Irish Summer Time 5531.3Schristos 1880–1916, 5541.3Schristos MMT/MST/MDST for Moscow 1880–1919, and 5551.3Schristos RMT/LST for Riga Mean Time and Latvian Summer time 1880–1926. 5561.12Schristos </small> 5571.3Schristos </p> 5581.3Schristos </li> 5591.3Schristos <li> 5601.3Schristos Use '<abbr>LMT</abbr>' for local mean time of locations before the 5611.3Schristos introduction of standard time; see "<a href="#scope">Scope of the 5621.3Schristos <code><abbr>tz</abbr></code> database</a>". 5631.3Schristos </li> 5641.3Schristos <li> 5651.3Schristos If there is no common English abbreviation, use numeric offsets like 5661.4Schristos <code>-</code>05 and <code>+</code>0530 that are generated 5671.3Schristos by <code>zic</code>'s <code>%z</code> notation. 5681.3Schristos </li> 5691.3Schristos <li> 5701.3Schristos Use current abbreviations for older timestamps to avoid confusion. 5711.3Schristos For example, in 1910 a common English abbreviation for time 5721.3Schristos in central Europe was 'MEZ' (short for both "Middle European 5731.3Schristos Zone" and for "Mitteleuropäische Zeit" in German). 5741.3Schristos Nowadays 'CET' ("Central European Time") is more common in 5751.3Schristos English, and the database uses 'CET' even for circa-1910 5761.3Schristos timestamps as this is less confusing for modern users and avoids 5771.3Schristos the need for determining when 'CET' supplanted 'MEZ' in common 5781.3Schristos usage. 5791.3Schristos </li> 5801.3Schristos <li> 5811.4Schristos Use a consistent style in a timezone's history. 5821.4Schristos For example, if a history tends to use numeric 5831.3Schristos abbreviations and a particular entry could go either way, use a 5841.3Schristos numeric abbreviation. 5851.3Schristos </li> 5861.3Schristos <li> 5871.3Schristos Use 5881.3Schristos <a href="https://en.wikipedia.org/wiki/Universal_Time">Universal Time</a> 5891.3Schristos (<abbr>UT</abbr>) (with time zone abbreviation '<code>-</code>00') for 5901.3Schristos locations while uninhabited. 5911.3Schristos The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in 5921.3Schristos some sense undefined; this notation is derived 5931.21Schristos from <a href="https://www.rfc-editor.org/rfc/rfc3339">Internet 5941.4Schristos <abbr title="Request For Comments">RFC</abbr> 3339</a>. 5951.20Schristos (The abbreviation 'Z' that 5961.21Schristos <a href="https://www.rfc-editor.org/rfc/rfc9557">Internet 5971.20Schristos <abbr>RFC</abbr> 9557</a> uses for this concept 5981.20Schristos would violate the POSIX requirement 5991.20Schristos of at least three characters in an abbreviation.) 6001.1Schristos </li> 6011.1Schristos</ul> 6021.3Schristos 6031.1Schristos<p> 6041.1SchristosApplication writers should note that these abbreviations are ambiguous 6051.2Schristosin practice: e.g., 'CST' means one thing in China and something else 6061.2Schristosin North America, and 'IST' can refer to time in India, Ireland or 6071.3SchristosIsrael. 6081.3SchristosTo avoid ambiguity, use numeric <abbr>UT</abbr> offsets like 6091.2Schristos'<code>-</code>0600' instead of time zone abbreviations like 'CST'. 6101.1Schristos</p> 6111.3Schristos</section> 6121.1Schristos 6131.3Schristos<section> 6141.3Schristos <h2 id="accuracy">Accuracy of the <code><abbr>tz</abbr></code> database</h2> 6151.1Schristos<p> 6161.3SchristosThe <code><abbr>tz</abbr></code> database is not authoritative, and it 6171.3Schristossurely has errors. 6181.2SchristosCorrections are welcome and encouraged; see the file <code>CONTRIBUTING</code>. 6191.1SchristosUsers requiring authoritative data should consult national standards 6201.1Schristosbodies and the references cited in the database's comments. 6211.1Schristos</p> 6221.1Schristos 6231.1Schristos<p> 6241.3SchristosErrors in the <code><abbr>tz</abbr></code> database arise from many sources: 6251.1Schristos</p> 6261.3Schristos 6271.1Schristos<ul> 6281.1Schristos <li> 6291.3Schristos The <code><abbr>tz</abbr></code> database predicts future 6301.3Schristos timestamps, and current predictions 6311.3Schristos will be incorrect after future governments change the rules. 6321.3Schristos For example, if today someone schedules a meeting for 13:00 next 6331.3Schristos October 1, Casablanca time, and tomorrow Morocco changes its 6341.3Schristos daylight saving rules, software can mess up after the rule change 6351.3Schristos if it blithely relies on conversions made before the change. 6361.3Schristos </li> 6371.3Schristos <li> 6381.3Schristos The pre-1970 entries in this database cover only a tiny sliver of how 6391.3Schristos clocks actually behaved; the vast majority of the necessary 6401.3Schristos information was lost or never recorded. 6411.4Schristos Thousands more timezones would be needed if 6421.3Schristos the <code><abbr>tz</abbr></code> database's scope were extended to 6431.3Schristos cover even just the known or guessed history of standard time; for 6441.3Schristos example, the current single entry for France would need to split 6451.3Schristos into dozens of entries, perhaps hundreds. 6461.3Schristos And in most of the world even this approach would be misleading 6471.3Schristos due to widespread disagreement or indifference about what times 6481.3Schristos should be observed. 6491.3Schristos In her 2015 book 6501.3Schristos <cite><a 6511.15Schristos href="https://www.hup.harvard.edu/catalog.php?isbn=9780674286146">The 6521.3Schristos Global Transformation of Time, 1870–1950</a></cite>, 6531.3Schristos Vanessa Ogle writes 6541.3Schristos "Outside of Europe and North America there was no system of time 6551.3Schristos zones at all, often not even a stable landscape of mean times, 6561.3Schristos prior to the middle decades of the twentieth century". 6571.3Schristos See: Timothy Shenk, <a 6581.3Schristoshref="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle">Booked: 6591.3Schristos A Global History of Time</a>. <cite>Dissent</cite> 2015-12-17. 6601.3Schristos </li> 6611.3Schristos <li> 6621.3Schristos Most of the pre-1970 data entries come from unreliable sources, often 6631.3Schristos astrology books that lack citations and whose compilers evidently 6641.3Schristos invented entries when the true facts were unknown, without 6651.3Schristos reporting which entries were known and which were invented. 6661.3Schristos These books often contradict each other or give implausible entries, 6671.3Schristos and on the rare occasions when they are checked they are 6681.3Schristos typically found to be incorrect. 6691.3Schristos </li> 6701.3Schristos <li> 6711.3Schristos For the UK the <code><abbr>tz</abbr></code> database relies on 6721.3Schristos years of first-class work done by 6731.3Schristos Joseph Myers and others; see 6741.3Schristos "<a href="https://www.polyomino.org.uk/british-time/">History of 6751.3Schristos legal time in Britain</a>". 6761.3Schristos Other countries are not done nearly as well. 6771.3Schristos </li> 6781.3Schristos <li> 6791.3Schristos Sometimes, different people in the same city maintain clocks 6801.3Schristos that differ significantly. 6811.3Schristos Historically, railway time was used by railroad companies (which 6821.3Schristos did not always 6831.3Schristos agree with each other), church-clock time was used for birth 6841.3Schristos certificates, etc. 6851.3Schristos More recently, competing political groups might disagree about 6861.3Schristos clock settings. Often this is merely common practice, but 6871.3Schristos sometimes it is set by law. 6881.3Schristos For example, from 1891 to 1911 the <abbr>UT</abbr> offset in France 6891.3Schristos was legally <abbr>UT</abbr> +00:09:21 outside train stations and 6901.3Schristos <abbr>UT</abbr> +00:04:21 inside. Other examples include 6911.3Schristos Chillicothe in 1920, Palm Springs in 1946/7, and Jerusalem and 6921.3Schristos Ürümqi to this day. 6931.3Schristos </li> 6941.3Schristos <li> 6951.3Schristos Although a named location in the <code><abbr>tz</abbr></code> 6961.3Schristos database stands for the containing region, its pre-1970 data 6971.3Schristos entries are often accurate for only a small subset of that region. 6981.3Schristos For example, <code>Europe/London</code> stands for the United 6991.3Schristos Kingdom, but its pre-1847 times are valid only for locations that 7001.3Schristos have London's exact meridian, and its 1847 transition 7011.3Schristos to <abbr>GMT</abbr> is known to be valid only for the L&NW and 7021.3Schristos the Caledonian railways. 7031.3Schristos </li> 7041.3Schristos <li> 7051.3Schristos The <code><abbr>tz</abbr></code> database does not record the 7061.4Schristos earliest time for which a timezone's 7071.3Schristos data entries are thereafter valid for every location in the region. 7081.3Schristos For example, <code>Europe/London</code> is valid for all locations 7091.3Schristos in its region after <abbr>GMT</abbr> was made the standard time, 7101.3Schristos but the date of standardization (1880-08-02) is not in the 7111.3Schristos <code><abbr>tz</abbr></code> database, other than in commentary. 7121.4Schristos For many timezones the earliest time of 7131.3Schristos validity is unknown. 7141.3Schristos </li> 7151.3Schristos <li> 7161.3Schristos The <code><abbr>tz</abbr></code> database does not record a 7171.3Schristos region's boundaries, and in many cases the boundaries are not known. 7181.4Schristos For example, the timezone 7191.3Schristos <code>America/Kentucky/Louisville</code> represents a region 7201.3Schristos around the city of Louisville, the boundaries of which are 7211.3Schristos unclear. 7221.3Schristos </li> 7231.3Schristos <li> 7241.3Schristos Changes that are modeled as instantaneous transitions in the 7251.3Schristos <code><abbr>tz</abbr></code> 7261.3Schristos database were often spread out over hours, days, or even decades. 7271.3Schristos </li> 7281.3Schristos <li> 7291.3Schristos Even if the time is specified by law, locations sometimes 7301.3Schristos deliberately flout the law. 7311.3Schristos </li> 7321.3Schristos <li> 7331.3Schristos Early timekeeping practices, even assuming perfect clocks, were 7341.3Schristos often not specified to the accuracy that the 7351.3Schristos <code><abbr>tz</abbr></code> database requires. 7361.3Schristos </li> 7371.3Schristos <li> 7381.10Schristos The <code><abbr>tz</abbr></code> database cannot represent stopped clocks. 7391.10Schristos However, on 1911-03-11 at 00:00, some public-facing French clocks 7401.10Schristos were changed by stopping them for a few minutes to effect a transition. 7411.10Schristos The <code><abbr>tz</abbr></code> database models this via a 7421.10Schristos backward transition; the relevant French legislation does not 7431.10Schristos specify exactly how the transition was to occur. 7441.10Schristos </li> 7451.10Schristos <li> 7461.3Schristos Sometimes historical timekeeping was specified more precisely 7471.3Schristos than what the <code><abbr>tz</abbr></code> code can handle. 7481.12Schristos For example, from 1880 to 1916 clocks in Ireland observed Dublin Mean 7491.3Schristos Time (estimated to be <abbr>UT</abbr> 7501.14Schristos −00:25:21.1); although the <code><abbr>tz</abbr></code> 7511.14Schristos source data can represent the .1 second, TZif files and the code cannot. 7521.3Schristos In practice these old specifications were rarely if ever 7531.3Schristos implemented to subsecond precision. 7541.3Schristos </li> 7551.3Schristos <li> 7561.3Schristos Even when all the timestamp transitions recorded by the 7571.3Schristos <code><abbr>tz</abbr></code> database are correct, the 7581.3Schristos <code><abbr>tz</abbr></code> rules that generate them may not 7591.3Schristos faithfully reflect the historical rules. 7601.3Schristos For example, from 1922 until World War II the UK moved clocks 7611.3Schristos forward the day following the third Saturday in April unless that 7621.3Schristos was Easter, in which case it moved clocks forward the previous 7631.3Schristos Sunday. 7641.3Schristos Because the <code><abbr>tz</abbr></code> database has no 7651.3Schristos way to specify Easter, these exceptional years are entered as 7661.3Schristos separate <code><abbr>tz</abbr> Rule</code> lines, even though the 7671.3Schristos legal rules did not change. 7681.4Schristos When transitions are known but the historical rules behind them are not, 7691.4Schristos the database contains <code>Zone</code> and <code>Rule</code> 7701.4Schristos entries that are intended to represent only the generated 7711.4Schristos transitions, not any underlying historical rules; however, this 7721.4Schristos intent is recorded at best only in commentary. 7731.3Schristos </li> 7741.3Schristos <li> 7751.4Schristos The <code><abbr>tz</abbr></code> database models time 7761.3Schristos using the <a 7771.3Schristos href="https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">proleptic 7781.4Schristos Gregorian calendar</a> with days containing 24 equal-length hours 7791.4Schristos numbered 00 through 23, except when clock transitions occur. 7801.4Schristos Pre-standard time is modeled as local mean time. 7811.4Schristos However, historically many people used other calendars and other timescales. 7821.3Schristos For example, the Roman Empire used 7831.3Schristos the <a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian 7841.3Schristos calendar</a>, 7851.3Schristos and <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">Roman 7861.3Schristos timekeeping</a> had twelve varying-length daytime hours with a 7871.3Schristos non-hour-based system at night. 7881.4Schristos And even today, some local practices diverge from the Gregorian 7891.4Schristos calendar with 24-hour days. These divergences range from 7901.4Schristos relatively minor, such as Japanese bars giving times like "24:30" for the 7911.4Schristos wee hours of the morning, to more-significant differences such as <a 7921.19Schristos href="https://theworld.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time">the 7931.4Schristos east African practice of starting the day at dawn</a>, renumbering 7941.4Schristos the Western 06:00 to be 12:00. These practices are largely outside 7951.4Schristos the scope of the <code><abbr>tz</abbr></code> code and data, which 7961.4Schristos provide only limited support for date and time localization 7971.20Schristos such as that required by POSIX. 7981.12Schristos If <abbr>DST</abbr> is not used a different time zone 7991.4Schristos can often do the trick; for example, in Kenya a <code>TZ</code> setting 8001.4Schristos like <code><-03>3</code> or <code>America/Cayenne</code> starts 8011.4Schristos the day six hours later than <code>Africa/Nairobi</code> does. 8021.3Schristos </li> 8031.3Schristos <li> 8041.3Schristos Early clocks were less reliable, and data entries do not represent 8051.3Schristos clock error. 8061.3Schristos </li> 8071.3Schristos <li> 8081.3Schristos The <code><abbr>tz</abbr></code> database assumes Universal Time 8091.3Schristos (<abbr>UT</abbr>) as an origin, even though <abbr>UT</abbr> is not 8101.3Schristos standardized for older timestamps. 8111.3Schristos In the <code><abbr>tz</abbr></code> database commentary, 8121.3Schristos <abbr>UT</abbr> denotes a family of time standards that includes 8131.3Schristos Coordinated Universal Time (<abbr>UTC</abbr>) along with other 8141.3Schristos variants such as <abbr>UT1</abbr> and <abbr>GMT</abbr>, 8151.3Schristos with days starting at midnight. 8161.3Schristos Although <abbr>UT</abbr> equals <abbr>UTC</abbr> for modern 8171.3Schristos timestamps, <abbr>UTC</abbr> was not defined until 1960, so 8181.18Schristos commentary uses the more general abbreviation <abbr>UT</abbr> for 8191.3Schristos timestamps that might predate 1960. 8201.3Schristos Since <abbr>UT</abbr>, <abbr>UT1</abbr>, etc. disagree slightly, 8211.3Schristos and since pre-1972 <abbr>UTC</abbr> seconds varied in length, 8221.3Schristos interpretation of older timestamps can be problematic when 8231.3Schristos subsecond accuracy is needed. 8241.3Schristos </li> 8251.3Schristos <li> 8261.3Schristos Civil time was not based on atomic time before 1972, and we do not 8271.3Schristos know the history of 8281.3Schristos <a href="https://en.wikipedia.org/wiki/Earth's_rotation">earth's 8291.3Schristos rotation</a> accurately enough to map <a 8301.3Schristos href="https://en.wikipedia.org/wiki/International_System_of_Units"><abbr 8311.3Schristos title="International System of Units">SI</abbr></a> seconds to 8321.3Schristos historical <a href="https://en.wikipedia.org/wiki/Solar_time">solar time</a> 8331.3Schristos to more than about one-hour accuracy. 8341.3Schristos See: Stephenson FR, Morrison LV, Hohenkerk CY. 8351.4Schristos <a href="https://dx.doi.org/10.1098/rspa.2016.0404">Measurement of 8361.3Schristos the Earth's rotation: 720 BC to AD 2015</a>. 8371.15Schristos <cite>Proc Royal Soc A</cite>. 2016;472:20160404. 8381.3Schristos Also see: Espenak F. <a 8391.3Schristos href="https://eclipse.gsfc.nasa.gov/SEhelp/uncertainty2004.html">Uncertainty 8401.3Schristos in Delta T (ΔT)</a>. 8411.3Schristos </li> 8421.3Schristos <li> 8431.3Schristos The relationship between POSIX time (that is, <abbr>UTC</abbr> but 8441.3Schristos ignoring <a href="https://en.wikipedia.org/wiki/Leap_second">leap 8451.18Schristos seconds</a>) and <abbr>UTC</abbr> is not agreed upon. 8461.18Schristos This affects time stamps during the leap second era (1972–2035). 8471.3Schristos Although the POSIX 8481.3Schristos clock officially stops during an inserted leap second, at least one 8491.3Schristos proposed standard has it jumping back a second instead; and in 8501.3Schristos practice POSIX clocks more typically either progress glacially during 8511.3Schristos a leap second, or are slightly slowed while near a leap second. 8521.3Schristos </li> 8531.3Schristos <li> 8541.3Schristos The <code><abbr>tz</abbr></code> database does not represent how 8551.3Schristos uncertain its information is. 8561.3Schristos Ideally it would contain information about when data entries are 8571.3Schristos incomplete or dicey. 8581.3Schristos Partial temporal knowledge is a field of active research, though, 8591.3Schristos and it is not clear how to apply it here. 8601.1Schristos </li> 8611.1Schristos</ul> 8621.1Schristos 8631.1Schristos<p> 8641.3SchristosIn short, many, perhaps most, of the <code><abbr>tz</abbr></code> 8651.3Schristosdatabase's pre-1970 and future timestamps are either wrong or 8661.3Schristosmisleading. 8671.3SchristosAny attempt to pass the 8681.3Schristos<code><abbr>tz</abbr></code> database off as the definition of time 8691.3Schristosshould be unacceptable to anybody who cares about the facts. 8701.3SchristosIn particular, the <code><abbr>tz</abbr></code> database's 8711.3Schristos<abbr>LMT</abbr> offsets should not be considered meaningful, and 8721.4Schristosshould not prompt creation of timezones 8731.3Schristosmerely because two locations 8741.3Schristosdiffer in <abbr>LMT</abbr> or transitioned to standard time at 8751.3Schristosdifferent dates. 8761.3Schristos</p> 8771.3Schristos</section> 8781.3Schristos 8791.3Schristos<section> 8801.3Schristos <h2 id="functions">Time and date functions</h2> 8811.3Schristos<p> 8821.3SchristosThe <code><abbr>tz</abbr></code> code contains time and date functions 8831.3Schristosthat are upwards compatible with those of POSIX. 8841.3SchristosCode compatible with this package is already 8851.3Schristos<a href="tz-link.html#tzdb">part of many platforms</a>, where the 8861.3Schristosprimary use of this package is to update obsolete time-related files. 8871.3SchristosTo do this, you may need to compile the time zone compiler 8881.20Schristos<code>zic</code> supplied with this package instead of using the 8891.20Schristossystem <code>zic</code>, since the format of <code>zic</code>'s 8901.3Schristosinput is occasionally extended, and a platform may still be shipping 8911.3Schristosan older <code>zic</code>. 8921.1Schristos</p> 8931.1Schristos 8941.20Schristos<p> 8951.20SchristosIn POSIX, time display in a process is controlled by the 8961.20Schristosenvironment variable <code>TZ</code>, which can have two forms: 8971.20Schristos</p> 8981.1Schristos<ul> 8991.1Schristos <li> 9001.20Schristos A <dfn>proleptic <code>TZ</code></dfn> value 9011.20Schristos like <code>CET-1CEST,M3.5.0,M10.5.0/3</code> uses a complex 9021.20Schristos notation that specifies a single standard time along with daylight 9031.20Schristos saving rules that apply to all years past, present, and future. 9041.20Schristos </li> 9051.20Schristos <li> 9061.20Schristos A <dfn>geographical <code>TZ</code></dfn> value 9071.20Schristos like <code>Europe/Berlin</code> names a location that stands for 9081.20Schristos civil time near that location, which can have more than 9091.20Schristos one standard time and more than one set of daylight saving rules, 9101.20Schristos to record timekeeping practice more accurately. 9111.20Schristos These names are defined by the <code><abbr>tz</abbr></code> database. 9121.20Schristos </li> 9131.20Schristos</ul> 9141.20Schristos 9151.20Schristos<h3 id="POSIX.1-2017">POSIX.1-2017 properties and limitations</h3> 9161.20Schristos<p> 9171.20SchristosSome platforms support only the features required by POSIX.1-2017, 9181.20Schristosand have not yet upgraded to POSIX.1-2024. 9191.20SchristosCode intended to be portable to these platforms must deal 9201.20Schristoswith problems that were fixed in later POSIX editions. 9211.20Schristos</p> 9221.20Schristos 9231.20Schristos<ul> 9241.20Schristos <li> 9251.20Schristos POSIX.1-2017 does not require support for geographical <code>TZ</code>, 9261.20Schristos and there is no convenient and efficient way to determine 9271.20Schristos the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary 9281.20Schristos timestamps, particularly for timezones 9291.20Schristos that do not fit into the POSIX model. 9301.20Schristos </li> 9311.20Schristos <li> 9321.1Schristos <p> 9331.20Schristos The proleptic <code>TZ</code> string, 9341.20Schristos which is all that POSIX.1-2017 requires, 9351.20Schristos has a format that is hard to describe and is error-prone in practice. 9361.20Schristos Also, proleptic <code>TZ</code> strings cannot deal with daylight 9371.3Schristos saving time rules not based on the Gregorian calendar (as in 9381.18Schristos Morocco), or with situations where more than two time zone 9391.3Schristos abbreviations or <abbr>UT</abbr> offsets are used in an area. 9401.1Schristos </p> 9411.3Schristos 9421.1Schristos <p> 9431.20Schristos A proleptic <code>TZ</code> string has the following format: 9441.1Schristos </p> 9451.3Schristos 9461.1Schristos <p> 9471.3Schristos <var>stdoffset</var>[<var>dst</var>[<var>offset</var>][<code>,</code><var>date</var>[<code>/</code><var>time</var>]<code>,</code><var>date</var>[<code>/</code><var>time</var>]]] 9481.1Schristos </p> 9491.3Schristos 9501.1Schristos <p> 9511.3Schristos where: 9521.3Schristos </p> 9531.3Schristos 9541.1Schristos <dl> 9551.1Schristos <dt><var>std</var> and <var>dst</var></dt><dd> 9561.3Schristos are 3 or more characters specifying the standard 9571.4Schristos and daylight saving time (<abbr>DST</abbr>) zone abbreviations. 9581.3Schristos Starting with POSIX.1-2001, <var>std</var> and <var>dst</var> 9591.3Schristos may also be in a quoted form like '<code><+09></code>'; 9601.3Schristos this allows "<code>+</code>" and "<code>-</code>" in the names. 9611.1Schristos </dd> 9621.1Schristos <dt><var>offset</var></dt><dd> 9631.3Schristos is of the form 9641.3Schristos '<code>[±]<var>hh</var>:[<var>mm</var>[:<var>ss</var>]]</code>' 9651.3Schristos and specifies the offset west of <abbr>UT</abbr>. 9661.3Schristos '<var>hh</var>' may be a single digit; 9671.3Schristos 0≤<var>hh</var>≤24. 9681.3Schristos The default <abbr>DST</abbr> offset is one hour ahead of 9691.3Schristos standard time. 9701.1Schristos </dd> 9711.1Schristos <dt><var>date</var>[<code>/</code><var>time</var>]<code>,</code><var>date</var>[<code>/</code><var>time</var>]</dt><dd> 9721.3Schristos specifies the beginning and end of <abbr>DST</abbr>. 9731.3Schristos If this is absent, the system supplies its own ruleset 9741.18Schristos for <abbr>DST</abbr>, typically current <abbr>US</abbr> 9751.18Schristos <abbr>DST</abbr> rules. 9761.1Schristos </dd> 9771.1Schristos <dt><var>time</var></dt><dd> 9781.3Schristos takes the form 9791.3Schristos '<var>hh</var><code>:</code>[<var>mm</var>[<code>:</code><var>ss</var>]]' 9801.3Schristos and defaults to 02:00. 9811.3Schristos This is the same format as the offset, except that a 9821.3Schristos leading '<code>+</code>' or '<code>-</code>' is not allowed. 9831.1Schristos </dd> 9841.1Schristos <dt><var>date</var></dt><dd> 9851.3Schristos takes one of the following forms: 9861.1Schristos <dl> 9871.1Schristos <dt>J<var>n</var> (1≤<var>n</var>≤365)</dt><dd> 9881.3Schristos origin-1 day number not counting February 29 9891.3Schristos </dd> 9901.1Schristos <dt><var>n</var> (0≤<var>n</var>≤365)</dt><dd> 9911.3Schristos origin-0 day number counting February 29 if present 9921.3Schristos </dd> 9931.3Schristos <dt><code>M</code><var>m</var><code>.</code><var>n</var><code>.</code><var>d</var> 9941.3Schristos (0[Sunday]≤<var>d</var>≤6[Saturday], 1≤<var>n</var>≤5, 9951.3Schristos 1≤<var>m</var>≤12)</dt><dd> 9961.3Schristos for the <var>d</var>th day of week <var>n</var> of 9971.3Schristos month <var>m</var> of the year, where week 1 is the first 9981.3Schristos week in which day <var>d</var> appears, and 9991.3Schristos '<code>5</code>' stands for the last week in which 10001.3Schristos day <var>d</var> appears (which may be either the 4th or 10011.3Schristos 5th week). 10021.3Schristos Typically, this is the only useful form; the <var>n</var> 10031.3Schristos and <code>J</code><var>n</var> forms are rarely used. 10041.1Schristos </dd> 10051.3Schristos </dl> 10061.3Schristos </dd> 10071.3Schristos </dl> 10081.3Schristos 10091.3Schristos <p> 10101.20Schristos Here is an example proleptic <code>TZ</code> string for New 10111.3Schristos Zealand after 2007. 10121.3Schristos It says that standard time (<abbr>NZST</abbr>) is 12 hours ahead 10131.3Schristos of <abbr>UT</abbr>, and that daylight saving time 10141.3Schristos (<abbr>NZDT</abbr>) is observed from September's last Sunday at 10151.3Schristos 02:00 until April's first Sunday at 03:00: 10161.3Schristos </p> 10171.3Schristos 10181.3Schristos <pre><code>TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'</code></pre> 10191.3Schristos 10201.3Schristos <p> 10211.20Schristos This proleptic <code>TZ</code> string is hard to remember, and 10221.3Schristos mishandles some timestamps before 2008. 10231.20Schristos With this package you can use a geographical <code>TZ</code> instead: 10241.3Schristos </p> 10251.3Schristos 10261.3Schristos <pre><code>TZ='Pacific/Auckland'</code></pre> 10271.3Schristos </li> 10281.20Schristos</ul> 10291.20Schristos 10301.20Schristos<p> 10311.20SchristosPOSIX.1-2017 also has the limitations of POSIX.1-2024, 10321.20Schristosdiscussed in the next section. 10331.20Schristos</p> 10341.20Schristos 10351.20Schristos<h3 id="POSIX.1-2024">POSIX.1-2024 properties and limitations</h3> 10361.20Schristos<p> 10371.20SchristosPOSIX.1-2024 extends POSIX.1-2017 in the following significant ways: 10381.20Schristos</p> 10391.20Schristos<ul> 10401.20Schristos <li> 10411.20Schristos POSIX.1-2024 requires support for geographical <code>TZ</code>. 10421.20Schristos Earlier POSIX editions require support only for proleptic <code>TZ</code>. 10431.20Schristos </li> 10441.20Schristos <li> 10451.20Schristos POSIX.1-2024 requires <code>struct tm</code> 10461.20Schristos to have a <abbr>UT</abbr> offset member <code>tm_gmtoff</code> 10471.20Schristos and a time zone abbreviation member <code>tm_zone</code>. 10481.20Schristos Earlier POSIX editions lack this requirement. 10491.20Schristos </li> 10501.3Schristos <li> 10511.20Schristos DST transition times can range from −167:59:59 10521.20Schristos to 167:59:59 instead of merely from 00:00:00 to 24:59:59. 10531.20Schristos This allows for proleptic TZ strings 10541.20Schristos like <code>"<-02>2<-01>,M3.5.0/-1,M10.5.0/0"</code> 10551.20Schristos where the transition time −1:00 means 23:00 the previous day. 10561.3Schristos </li> 10571.20Schristos</ul> 10581.20Schristos<p> 10591.20SchristosHowever POSIX.1-2024, like earlier POSIX editions, has some limitations: 10601.20Schristos<ul> 10611.3Schristos <li> 10621.3Schristos The <code>TZ</code> environment variable is process-global, which 10631.3Schristos makes it hard to write efficient, thread-safe applications that 10641.4Schristos need access to multiple timezones. 10651.3Schristos </li> 10661.3Schristos <li> 10671.3Schristos In POSIX, there is no tamper-proof way for a process to learn the 10681.8Schristos system's best idea of local (wall clock) time. 10691.4Schristos This is important for applications that an administrator wants 10701.3Schristos used only at certain times – without regard to whether the 10711.3Schristos user has fiddled the 10721.3Schristos <code>TZ</code> environment variable. 10731.3Schristos While an administrator can "do everything in <abbr>UT</abbr>" to 10741.3Schristos get around the problem, doing so is inconvenient and precludes 10751.4Schristos handling daylight saving time shifts – as might be required to 10761.4Schristos limit phone calls to off-peak hours. 10771.3Schristos </li> 10781.3Schristos <li> 10791.20Schristos POSIX requires that <code>time_t</code> clock counts exclude leap 10801.20Schristos seconds. 10811.3Schristos </li> 10821.3Schristos <li> 10831.20Schristos POSIX does not define the <abbr>DST</abbr> transitions 10841.20Schristos for <code>TZ</code> values like 10851.20Schristos "<code>EST5EDT</code>". 10861.20Schristos Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules 10871.20Schristos were used to interpret such values, but this meant that the 10881.20Schristos <abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each 10891.20Schristos time conversion package, and when 10901.20Schristos <abbr>US</abbr> time conversion rules changed (as in the United 10911.20Schristos States in 1987 and again in 2007), all packages that 10921.20Schristos interpreted <code>TZ</code> values had to be updated 10931.20Schristos to ensure proper results. 10941.3Schristos </li> 10951.20Schristos</ul> 10961.20Schristos 10971.20Schristos<h3 id="POSIX-extensions">Extensions to POSIX in the 10981.20Schristos<code><abbr>tz</abbr></code> code</h3> 10991.20Schristos<p> 11001.20Schristos The <code><abbr>tz</abbr></code> code defines some properties 11011.20Schristos left unspecified by POSIX, and attempts to support some 11021.20Schristos extensions to POSIX. 11031.20Schristos</p> 11041.20Schristos 11051.20Schristos<ul> 11061.3Schristos <li> 11071.3Schristos The <code><abbr>tz</abbr></code> code attempts to support all the 11081.3Schristos <code>time_t</code> implementations allowed by POSIX. 11091.3Schristos The <code>time_t</code> type represents a nonnegative count of seconds 11101.3Schristos since 1970-01-01 00:00:00 <abbr>UTC</abbr>, ignoring leap seconds. 11111.3Schristos In practice, <code>time_t</code> is usually a signed 64- or 32-bit 11121.3Schristos integer; 32-bit signed <code>time_t</code> values stop working after 11131.3Schristos 2038-01-19 03:14:07 <abbr>UTC</abbr>, so new implementations these 11141.3Schristos days typically use a signed 64-bit integer. 11151.3Schristos Unsigned 32-bit integers are used on one or two platforms, and 36-bit 11161.3Schristos and 40-bit integers are also used occasionally. 11171.3Schristos Although earlier POSIX versions allowed <code>time_t</code> to be a 11181.4Schristos floating-point type, this was not supported by any practical system, 11191.20Schristos and POSIX.1-2013+ and the <code><abbr>tz</abbr></code> code both 11201.3Schristos require <code>time_t</code> to be an integer type. 11211.1Schristos </li> 11221.1Schristos <li> 11231.1Schristos <p> 11241.20Schristos If the <code>TZ</code> environment variable uses the geographical format, 11251.20Schristos it is used in generating 11261.20Schristos the name of a file from which time-related information is read. 11271.4Schristos The file's format is <dfn><abbr>TZif</abbr></dfn>, 11281.7Schristos a timezone information format that contains binary data; see 11291.21Schristos <a href="https://www.rfc-editor.org/rfc/9636">Internet 11301.21Schristos <abbr>RFC</abbr> 9636</a>. 11311.3Schristos The daylight saving time rules to be used for a 11321.4Schristos particular timezone are encoded in the 11331.4Schristos <abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>, 11341.4Schristos Australian, and other rules to be encoded, and 11351.3Schristos allows for situations where more than two time zone 11361.3Schristos abbreviations are used. 11371.1Schristos </p> 11381.1Schristos <p> 11391.20Schristos When the <code><abbr>tz</abbr></code> code was developed in the 1980s, 11401.20Schristos it was recognized that allowing the <code>TZ</code> environment 11411.3Schristos variable to take on values such as '<code>America/New_York</code>' 11421.3Schristos might cause "old" programs (that expect <code>TZ</code> to have a 11431.20Schristos certain format) to operate incorrectly; consideration was given to using 11441.3Schristos some other environment variable (for example, <code>TIMEZONE</code>) 11451.4Schristos to hold the string used to generate the <abbr>TZif</abbr> file's name. 11461.3Schristos In the end, however, it was decided to continue using 11471.3Schristos <code>TZ</code>: it is widely used for time zone purposes; 11481.3Schristos separately maintaining both <code>TZ</code> 11491.3Schristos and <code>TIMEZONE</code> seemed a nuisance; and systems where 11501.3Schristos "new" forms of <code>TZ</code> might cause problems can simply 11511.4Schristos use legacy <code>TZ</code> values such as "<code>EST5EDT</code>" which 11521.4Schristos can be used by "new" programs as well as by "old" programs that 11531.4Schristos assume pre-POSIX <code>TZ</code> values. 11541.1Schristos </p> 11551.3Schristos </li> 11561.3Schristos <li> 11571.3Schristos Functions <code>tzalloc</code>, <code>tzfree</code>, 11581.3Schristos <code>localtime_rz</code>, and <code>mktime_z</code> for 11591.3Schristos more-efficient thread-safe applications that need to use multiple 11601.4Schristos timezones. 11611.3Schristos The <code>tzalloc</code> and <code>tzfree</code> functions 11621.3Schristos allocate and free objects of type <code>timezone_t</code>, 11631.3Schristos and <code>localtime_rz</code> and <code>mktime_z</code> are 11641.3Schristos like <code>localtime_r</code> and <code>mktime</code> with an 11651.3Schristos extra <code>timezone_t</code> argument. 11661.20Schristos The functions were inspired by <a href="https://netbsd.org">NetBSD</a>. 11671.3Schristos </li> 11681.3Schristos <li> 11691.3Schristos Negative <code>time_t</code> values are supported, on systems 11701.3Schristos where <code>time_t</code> is signed. 11711.3Schristos </li> 11721.3Schristos <li> 11731.9Schristos These functions can account for leap seconds; 11741.9Schristos see <a href="#leapsec">Leap seconds</a> below. 11751.3Schristos </li> 11761.1Schristos</ul> 11771.3Schristos 11781.3Schristos<h3 id="vestigial">POSIX features no longer needed</h3> 11791.1Schristos<p> 11801.3SchristosPOSIX and <a href="https://en.wikipedia.org/wiki/ISO_C"><abbr>ISO</abbr> C</a> 11811.3Schristosdefine some <a href="https://en.wikipedia.org/wiki/API"><abbr 11821.3Schristostitle="application programming interface">API</abbr>s</a> that are vestigial: 11831.3Schristosthey are not needed, and are relics of a too-simple model that does 11841.3Schristosnot suffice to handle many real-world timestamps. 11851.3SchristosAlthough the <code><abbr>tz</abbr></code> code supports these 11861.3Schristosvestigial <abbr>API</abbr>s for backwards compatibility, they should 11871.3Schristosbe avoided in portable applications. 11881.3SchristosThe vestigial <abbr>API</abbr>s are: 11891.1Schristos</p> 11901.1Schristos<ul> 11911.1Schristos <li> 11921.3Schristos The POSIX <code>tzname</code> variable does not suffice and is no 11931.3Schristos longer needed. 11941.20Schristos It is planned to be removed in a future edition of POSIX. 11951.3Schristos To get a timestamp's time zone abbreviation, consult 11961.3Schristos the <code>tm_zone</code> member if available; otherwise, 11971.3Schristos use <code>strftime</code>'s <code>"%Z"</code> conversion 11981.3Schristos specification. 11991.3Schristos </li> 12001.3Schristos <li> 12011.3Schristos The POSIX <code>daylight</code> and <code>timezone</code> 12021.3Schristos variables do not suffice and are no longer needed. 12031.20Schristos They are planned to be removed in a future edition of POSIX. 12041.3Schristos To get a timestamp's <abbr>UT</abbr> offset, consult 12051.3Schristos the <code>tm_gmtoff</code> member if available; otherwise, 12061.3Schristos subtract values returned by <code>localtime</code> 12071.3Schristos and <code>gmtime</code> using the rules of the Gregorian calendar, 12081.3Schristos or use <code>strftime</code>'s <code>"%z"</code> conversion 12091.3Schristos specification if a string like <code>"+0900"</code> suffices. 12101.3Schristos </li> 12111.3Schristos <li> 12121.3Schristos The <code>tm_isdst</code> member is almost never needed and most of 12131.3Schristos its uses should be discouraged in favor of the abovementioned 12141.3Schristos <abbr>API</abbr>s. 12151.21Schristos It was intended as an index into the <code>tzname</code> variable, 12161.21Schristos but as mentioned previously that usage is obsolete. 12171.3Schristos Although it can still be used in arguments to 12181.3Schristos <code>mktime</code> to disambiguate timestamps near 12191.15Schristos a <abbr>DST</abbr> transition when the clock jumps back on 12201.15Schristos platforms lacking <code>tm_gmtoff</code>, this 12211.21Schristos disambiguation works only for proleptic <code>TZ</code> strings; 12221.21Schristos it does not work in general for geographical timezones, 12231.21Schristos such as when a location changes to a time zone with a 12241.3Schristos lesser <abbr>UT</abbr> offset. 12251.3Schristos </li> 12261.3Schristos</ul> 12271.3Schristos 12281.3Schristos<h3 id="other-portability">Other portability notes</h3> 12291.3Schristos<ul> 12301.3Schristos <li> 12311.3Schristos The <a href="https://en.wikipedia.org/wiki/Version_7_Unix">7th Edition 12321.3Schristos UNIX</a> <code>timezone</code> function is not present in this 12331.3Schristos package; it is impossible to reliably map <code>timezone</code>'s 12341.3Schristos arguments (a "minutes west of <abbr>GMT</abbr>" value and a 12351.3Schristos "daylight saving time in effect" flag) to a time zone 12361.3Schristos abbreviation, and we refuse to guess. 12371.3Schristos Programs that in the past used the <code>timezone</code> function 12381.3Schristos may now examine <code>localtime(&clock)->tm_zone</code> 12391.3Schristos (if <code>TM_ZONE</code> is defined) or 12401.21Schristos use <code>strftime</code> with a <code>%Z</code> conversion specification 12411.21Schristos to learn the correct time 12421.3Schristos zone abbreviation to use. 12431.3Schristos </li> 12441.3Schristos <li> 12451.3Schristos The <a 12461.3Schristos href="https://en.wikipedia.org/wiki/History_of_the_Berkeley_Software_Distribution#4.2BSD"><abbr>4.2BSD</abbr></a> 12471.3Schristos <code>gettimeofday</code> function is not 12481.3Schristos used in this package. 12491.3Schristos This formerly let users obtain the current <abbr>UTC</abbr> offset 12501.3Schristos and <abbr>DST</abbr> flag, but this functionality was removed in 12511.3Schristos later versions of <abbr>BSD</abbr>. 12521.3Schristos </li> 12531.3Schristos <li> 12541.3Schristos In <abbr>SVR2</abbr>, time conversion fails for near-minimum or 12551.3Schristos near-maximum <code>time_t</code> values when doing conversions 12561.3Schristos for places that do not use <abbr>UT</abbr>. 12571.3Schristos This package takes care to do these conversions correctly. 12581.3Schristos A comment in the source code tells how to get compatibly wrong 12591.3Schristos results. 12601.3Schristos </li> 12611.3Schristos <li> 12621.3Schristos The functions that are conditionally compiled 12631.18Schristos if <code>STD_INSPIRED</code> is nonzero should, at this point, be 12641.3Schristos looked on primarily as food for thought. 12651.3Schristos They are not in any sense "standard compatible" – some are 12661.3Schristos not, in fact, specified in <em>any</em> standard. 12671.3Schristos They do, however, represent responses of various authors to 12681.3Schristos standardization proposals. 12691.3Schristos </li> 12701.3Schristos <li> 12711.4Schristos Other time conversion proposals, in particular those supported by the 12721.4Schristos <a href="https://howardhinnant.github.io/date/tz.html">Time Zone 12731.4Schristos Database Parser</a>, offer a wider selection of functions 12741.3Schristos that provide capabilities beyond those provided here. 12751.3Schristos The absence of such functions from this package is not meant to 12761.3Schristos discourage the development, standardization, or use of such 12771.3Schristos functions. 12781.3Schristos Rather, their absence reflects the decision to make this package 12791.3Schristos contain valid extensions to POSIX, to ensure its broad 12801.3Schristos acceptability. 12811.3Schristos If more powerful time conversion functions can be standardized, so 12821.3Schristos much the better. 12831.1Schristos </li> 12841.1Schristos</ul> 12851.3Schristos</section> 12861.1Schristos 12871.3Schristos<section> 12881.3Schristos <h2 id="stability">Interface stability</h2> 12891.1Schristos<p> 12901.3SchristosThe <code><abbr>tz</abbr></code> code and data supply the following interfaces: 12911.1Schristos</p> 12921.1Schristos 12931.1Schristos<ul> 12941.1Schristos <li> 12951.4Schristos A set of timezone names as per 12961.7Schristos "<a href="#naming">Timezone identifiers</a>" above. 12971.1Schristos </li> 12981.1Schristos <li> 12991.3Schristos Library functions described in "<a href="#functions">Time and date 13001.3Schristos functions</a>" above. 13011.1Schristos </li> 13021.1Schristos <li> 13031.3Schristos The programs <code>tzselect</code>, <code>zdump</code>, 13041.3Schristos and <code>zic</code>, documented in their man pages. 13051.1Schristos </li> 13061.1Schristos <li> 13071.3Schristos The format of <code>zic</code> input files, documented in 13081.3Schristos the <code>zic</code> man page. 13091.1Schristos </li> 13101.1Schristos <li> 13111.3Schristos The format of <code>zic</code> output files, documented in 13121.3Schristos the <code>tzfile</code> man page. 13131.1Schristos </li> 13141.1Schristos <li> 13151.3Schristos The format of zone table files, documented in <code>zone1970.tab</code>. 13161.1Schristos </li> 13171.1Schristos <li> 13181.3Schristos The format of the country code file, documented in <code>iso3166.tab</code>. 13191.1Schristos </li> 13201.1Schristos <li> 13211.3Schristos The version number of the code and data, as the first line of 13221.3Schristos the text file '<code>version</code>' in each release. 13231.1Schristos </li> 13241.1Schristos</ul> 13251.3Schristos 13261.1Schristos<p> 13271.1SchristosInterface changes in a release attempt to preserve compatibility with 13281.3Schristosrecent releases. 13291.3SchristosFor example, <code><abbr>tz</abbr></code> data files typically do not 13301.18Schristosrely on recently added <code>zic</code> features, so that users can 13311.3Schristosrun older <code>zic</code> versions to process newer data files. 13321.3Schristos<a href="tz-link.html#download">Downloading 13331.3Schristosthe <code><abbr>tz</abbr></code> database</a> describes how releases 13341.3Schristosare tagged and distributed. 13351.1Schristos</p> 13361.1Schristos 13371.1Schristos<p> 13381.3SchristosInterfaces not listed above are less stable. 13391.3SchristosFor example, users should not rely on particular <abbr>UT</abbr> 13401.3Schristosoffsets or abbreviations for timestamps, as data entries are often 13411.3Schristosbased on guesswork and these guesses may be corrected or improved. 13421.1Schristos</p> 13431.7Schristos 13441.7Schristos<p> 13451.7SchristosTimezone boundaries are not part of the stable interface. 13461.7SchristosFor example, even though the <samp>Asia/Bangkok</samp> timezone 13471.7Schristoscurrently includes Chang Mai, Hanoi, and Phnom Penh, this is not part 13481.7Schristosof the stable interface and the timezone can split at any time. 13491.7SchristosIf a calendar application records a future event in some location other 13501.7Schristosthan Bangkok by putting "<samp>Asia/Bangkok</samp>" in the event's record, 13511.7Schristosthe application should be robust in the presence of timezone splits 13521.7Schristosbetween now and the future time. 13531.7Schristos</p> 13541.3Schristos</section> 13551.1Schristos 13561.3Schristos<section> 13571.9Schristos <h2 id="leapsec">Leap seconds</h2> 13581.9Schristos<p> 13591.18SchristosLeap seconds were introduced in 1972 to accommodate the 13601.18Schristosdifference between atomic time and the less regular rotation of the earth. 13611.20SchristosUnfortunately they have caused so many problems with civil 13621.20Schristostimekeeping that there are 13631.20Schristos<a href="https://www.bipm.org/en/cgpm-2022/resolution-4">plans 13641.20Schristosto discontinue them by 2035</a>. 13651.20SchristosEven if these plans come to fruition, a record of leap seconds will still be 13661.20Schristosneeded to resolve timestamps from 1972 through 2035, 13671.20Schristosand there may also be a need to record whatever mechanism replaces them. 13681.18Schristos</p> 13691.18Schristos 13701.18Schristos<p> 13711.9SchristosThe <code><abbr>tz</abbr></code> code and data can account for leap seconds, 13721.9Schristosthanks to code contributed by Bradley White. 13731.9SchristosHowever, the leap second support of this package is rarely used directly 13741.9Schristosbecause POSIX requires leap seconds to be excluded and many 13751.9Schristossoftware packages would mishandle leap seconds if they were present. 13761.9SchristosInstead, leap seconds are more commonly handled by occasionally adjusting 13771.9Schristosthe operating system kernel clock as described in 13781.9Schristos<a href="tz-link.html#precision">Precision timekeeping</a>, 13791.9Schristosand this package by default installs a <samp>leapseconds</samp> file 13801.9Schristoscommonly used by 13811.15Schristos<a href="https://www.ntp.org"><abbr title="Network Time Protocol">NTP</abbr></a> 13821.9Schristossoftware that adjusts the kernel clock. 13831.9SchristosHowever, kernel-clock twiddling approximates UTC only roughly, 13841.18Schristosand systems needing more precise UTC can use this package's leap 13851.9Schristossecond support directly. 13861.9Schristos</p> 13871.9Schristos 13881.9Schristos<p> 13891.18SchristosThe directly supported mechanism assumes that <code>time_t</code> 13901.9Schristoscounts of seconds since the POSIX epoch normally include leap seconds, 13911.9Schristosas opposed to POSIX <code>time_t</code> counts which exclude leap seconds. 13921.9SchristosThis modified timescale is converted to <abbr>UTC</abbr> 13931.12Schristosat the same point that time zone and <abbr>DST</abbr> 13941.12Schristosadjustments are applied – 13951.9Schristosnamely, at calls to <code>localtime</code> and analogous functions – 13961.9Schristosand the process is driven by leap second information 13971.9Schristosstored in alternate versions of the <abbr>TZif</abbr> files. 13981.9SchristosBecause a leap second adjustment may be needed even 13991.9Schristosif no time zone correction is desired, 14001.9Schristoscalls to <code>gmtime</code>-like functions 14011.9Schristosalso need to consult a <abbr>TZif</abbr> file, 14021.14Schristosconventionally named <samp><abbr>Etc/UTC</abbr></samp> 14031.14Schristos(<samp><abbr>GMT</abbr></samp> in previous versions), 14041.9Schristosto see whether leap second corrections are needed. 14051.9SchristosTo convert an application's <code>time_t</code> timestamps to or from 14061.9SchristosPOSIX <code>time_t</code> timestamps (for use when, say, 14071.9Schristosembedding or interpreting timestamps in portable 14081.9Schristos<a href="https://en.wikipedia.org/wiki/Tar_(computing)"><code>tar</code></a> 14091.9Schristosfiles), 14101.9Schristosthe application can call the utility functions 14111.9Schristos<code>time2posix</code> and <code>posix2time</code> 14121.9Schristosincluded with this package. 14131.9Schristos</p> 14141.9Schristos 14151.9Schristos<p> 14161.9SchristosIf the POSIX-compatible <abbr>TZif</abbr> file set is installed 14171.9Schristosin a directory whose basename is <samp>zoneinfo</samp>, the 14181.9Schristosleap-second-aware file set is by default installed in a separate 14191.9Schristosdirectory <samp>zoneinfo-leaps</samp>. 14201.9SchristosAlthough each process can have its own time zone by setting 14211.9Schristosits <code>TZ</code> environment variable, there is no support for some 14221.9Schristosprocesses being leap-second aware while other processes are 14231.9SchristosPOSIX-compatible; the leap-second choice is system-wide. 14241.9SchristosSo if you configure your kernel to count leap seconds, you should also 14251.9Schristosdiscard <samp>zoneinfo</samp> and rename <samp>zoneinfo-leaps</samp> 14261.9Schristosto <samp>zoneinfo</samp>. 14271.9SchristosAlternatively, you can install just one set of <abbr>TZif</abbr> files 14281.9Schristosin the first place; see the <code>REDO</code> variable in this package's 14291.9Schristos<a href="https://en.wikipedia.org/wiki/Makefile">makefile</a>. 14301.9Schristos</p> 14311.9Schristos</section> 14321.9Schristos 14331.9Schristos<section> 14341.3Schristos <h2 id="calendar">Calendrical issues</h2> 14351.1Schristos<p> 14361.1SchristosCalendrical issues are a bit out of scope for a time zone database, 14371.1Schristosbut they indicate the sort of problems that we would run into if we 14381.3Schristosextended the time zone database further into the past. 14391.3SchristosAn excellent resource in this area is Edward M. Reingold 14401.3Schristosand Nachum Dershowitz, <cite><a 14411.3Schristoshref="https://www.cambridge.org/fr/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition">Calendrical 14421.3SchristosCalculations: The Ultimate Edition</a></cite>, Cambridge University Press (2018). 14431.3SchristosOther information and sources are given in the file '<code>calendars</code>' 14441.3Schristosin the <code><abbr>tz</abbr></code> distribution. 14451.3SchristosThey sometimes disagree. 14461.3Schristos</p> 14471.3Schristos</section> 14481.3Schristos 14491.3Schristos<section> 14501.18Schristos <h2 id="planets">Time and time zones off Earth</h2> 14511.18Schristos<p> 14521.18SchristosThe European Space Agency is <a 14531.18Schristoshref='https://www.esa.int/Applications/Navigation/Telling_time_on_the_Moon'>considering</a> 14541.18Schristosthe establishment of a reference timescale for the Moon, which has 14551.18Schristosdays roughly equivalent to 29.5 Earth days, and where relativistic 14561.18Schristoseffects cause clocks to tick slightly faster than on Earth. 14571.20SchristosAlso, <abbr title="National Aeronautics and Space Administration">NASA</abbr> 14581.20Schristoshas been <a 14591.20Schristoshref='https://www.whitehouse.gov/wp-content/uploads/2024/04/Celestial-Time-Standardization-Policy.pdf'>ordered</a> 14601.20Schristosto consider the establishment of Coordinated Lunar Time (<abbr>LTC</abbr>). 14611.20SchristosIt is not yet known whether the US and European efforts will result in 14621.20Schristosmultiple timescales on the Moon. 14631.18Schristos</p> 14641.18Schristos 14651.3Schristos<p> 14661.10SchristosSome people's work schedules have used 14671.10Schristos<a href="https://en.wikipedia.org/wiki/Timekeeping_on_Mars">Mars time</a>. 14681.3SchristosJet Propulsion Laboratory (JPL) coordinators kept Mars time on 14691.3Schristosand off during the 14701.6Schristos<a href="https://en.wikipedia.org/wiki/Mars_Pathfinder">Mars 14711.10SchristosPathfinder</a> mission (1997). 14721.3SchristosSome of their family members also adapted to Mars time. 14731.3SchristosDozens of special Mars watches were built for JPL workers who kept 14741.10SchristosMars time during the 14751.10Schristos<a href="https://en.wikipedia.org/wiki/Mars_Exploration_Rover">Mars 14761.10SchristosExploration Rovers (MER)</a> mission (2004–2018). 14771.10SchristosThese timepieces looked like normal Seikos and Citizens but were adjusted 14781.10Schristosto use Mars seconds rather than terrestrial seconds, although 14791.10Schristosunfortunately the adjusted watches were unreliable and appear to have 14801.10Schristoshad only limited use. 14811.1Schristos</p> 14821.1Schristos 14831.1Schristos<p> 14841.1SchristosA Mars solar day is called a "sol" and has a mean period equal to 14851.3Schristosabout 24 hours 39 minutes 35.244 seconds in terrestrial time. 14861.3SchristosIt is divided into a conventional 24-hour clock, so each Mars second 14871.3Schristosequals about 1.02749125 terrestrial seconds. 14881.10Schristos(One MER worker noted, "If I am working Mars hours, and Mars hours are 14891.10Schristos2.5% more than Earth hours, shouldn't I get an extra 2.5% pay raise?") 14901.1Schristos</p> 14911.1Schristos 14921.1Schristos<p> 14931.3SchristosThe <a href="https://en.wikipedia.org/wiki/Prime_meridian">prime 14941.3Schristosmeridian</a> of Mars goes through the center of the crater 14951.3Schristos<a href="https://en.wikipedia.org/wiki/Airy-0">Airy-0</a>, named in 14961.3Schristoshonor of the British astronomer who built the Greenwich telescope that 14971.3Schristosdefines Earth's prime meridian. 14981.3SchristosMean solar time on the Mars prime meridian is 14991.6Schristoscalled Mars Coordinated Time (<abbr>MTC</abbr>). 15001.1Schristos</p> 15011.1Schristos 15021.1Schristos<p> 15031.1SchristosEach landed mission on Mars has adopted a different reference for 15041.4Schristossolar timekeeping, so there is no real standard for Mars time zones. 15051.10SchristosFor example, the MER mission defined two time zones "Local 15061.3SchristosSolar Time A" and "Local Solar Time B" for its two missions, each zone 15071.3Schristosdesigned so that its time equals local true solar time at 15081.3Schristosapproximately the middle of the nominal mission. 15091.10SchristosThe A and B zones differ enough so that an MER worker assigned to 15101.10Schristosthe A zone might suffer "Mars lag" when switching to work in the B zone. 15111.3SchristosSuch a "time zone" is not particularly suited for any application 15121.3Schristosother than the mission itself. 15131.1Schristos</p> 15141.1Schristos 15151.1Schristos<p> 15161.1SchristosMany calendars have been proposed for Mars, but none have achieved 15171.3Schristoswide acceptance. 15181.3SchristosAstronomers often use Mars Sol Date (<abbr>MSD</abbr>) which is a 15191.1Schristossequential count of Mars solar days elapsed since about 1873-12-29 15201.3Schristos12:00 <abbr>GMT</abbr>. 15211.1Schristos</p> 15221.1Schristos 15231.1Schristos<p> 15241.1SchristosIn our solar system, Mars is the planet with time and calendar most 15251.3Schristoslike Earth's. 15261.3SchristosOn other planets, Sun-based time and calendars would work quite 15271.3Schristosdifferently. 15281.3SchristosFor example, although Mercury's 15291.3Schristos<a href="https://en.wikipedia.org/wiki/Rotation_period">sidereal 15301.3Schristosrotation period</a> is 58.646 Earth days, Mercury revolves around the 15311.3SchristosSun so rapidly that an observer on Mercury's equator would see a 15321.3Schristossunrise only every 175.97 Earth days, i.e., a Mercury year is 0.5 of a 15331.3SchristosMercury day. 15341.3SchristosVenus is more complicated, partly because its rotation is slightly 15351.3Schristos<a href="https://en.wikipedia.org/wiki/Retrograde_motion">retrograde</a>: 15361.3Schristosits year is 1.92 of its days. 15371.3SchristosGas giants like Jupiter are trickier still, as their polar and 15381.3Schristosequatorial regions rotate at different rates, so that the length of a 15391.3Schristosday depends on latitude. 15401.3SchristosThis effect is most pronounced on Neptune, where the day is about 12 15411.3Schristoshours at the poles and 18 hours at the equator. 15421.1Schristos</p> 15431.1Schristos 15441.1Schristos<p> 15451.3SchristosAlthough the <code><abbr>tz</abbr></code> database does not support 15461.3Schristostime on other planets, it is documented here in the hopes that support 15471.3Schristoswill be added eventually. 15481.1Schristos</p> 15491.1Schristos 15501.1Schristos<p> 15511.3SchristosSources for time on other planets: 15521.1Schristos</p> 15531.3Schristos 15541.1Schristos<ul> 15551.1Schristos <li> 15561.3Schristos Michael Allison and Robert Schmunk, 15571.3Schristos "<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical 15581.3Schristos Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>" 15591.10Schristos (2020-03-08). 15601.10Schristos </li> 15611.10Schristos <li> 15621.10Schristos Zara Mirmalek, 15631.10Schristos <em><a href="https://mitpress.mit.edu/books/making-time-mars">Making 15641.10Schristos Time on Mars</a></em>, MIT Press (March 2020), ISBN 978-0262043854. 15651.1Schristos </li> 15661.1Schristos <li> 15671.3Schristos Jia-Rui Chong, 15681.8Schristos "<a href="https://www.latimes.com/archives/la-xpm-2004-jan-14-sci-marstime14-story.html">Workdays 15691.3Schristos Fit for a Martian</a>", <cite>Los Angeles Times</cite> 15701.3Schristos (2004-01-14), pp A1, A20–A21. 15711.1Schristos </li> 15721.1Schristos <li> 15731.3Schristos Tom Chmielewski, 15741.3Schristos "<a href="https://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/">Jet 15751.3Schristos Lag Is Worse on Mars</a>", <cite>The Atlantic</cite> (2015-02-26) 15761.1Schristos </li> 15771.1Schristos <li> 15781.3Schristos Matt Williams, 15791.3Schristos "<a href="https://www.universetoday.com/37481/days-of-the-planets/">How 15801.3Schristos long is a day on the other planets of the solar system?</a>" 15811.4Schristos (2016-01-20). 15821.1Schristos </li> 15831.1Schristos</ul> 15841.3Schristos</section> 15851.1Schristos 15861.3Schristos<footer> 15871.3Schristos <hr> 15881.3Schristos This file is in the public domain, so clarified as of 2009-05-17 by 15891.3Schristos Arthur David Olson. 15901.3Schristos</footer> 15911.1Schristos</body> 15921.1Schristos</html> 1593