theory.html revision 1.4
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.4Schristos      <li><a href="#naming">Names of timezones</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.1Schristos      <li><a href="#calendar">Calendrical issues</a></li>
251.1Schristos      <li><a href="#planets">Time and time zones on other planets</a></li>
261.1Schristos    </ul>
271.1Schristos  </nav>
281.1Schristos
291.3Schristos<section>
301.3Schristos  <h2 id="scope">Scope of the <code><abbr>tz</abbr></code> database</h2>
311.1Schristos<p>
321.3SchristosThe <a
331.3Schristoshref="https://www.iana.org/time-zones"><code><abbr>tz</abbr></code>
341.3Schristosdatabase</a> attempts to record the history and predicted future of
351.3Schristosall computer-based clocks that track civil time.
361.3SchristosIt organizes <a href="tz-link.html">time zone and daylight saving time
371.3Schristosdata</a> by partitioning the world into <a
381.4Schristoshref="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><dfn>timezones</dfn></a>
391.3Schristoswhose clocks all agree about timestamps that occur after the <a
401.3Schristoshref="https://en.wikipedia.org/wiki/Unix_time">POSIX Epoch</a>
411.3Schristos(1970-01-01 00:00:00 <a
421.3Schristoshref="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr
431.3Schristostitle="Coordinated Universal Time">UTC</abbr></a>).
441.4SchristosThe database labels each timezone with a notable location and
451.3Schristosrecords all known clock transitions for that location.
461.3SchristosAlthough 1970 is a somewhat-arbitrary cutoff, there are significant
471.3Schristoschallenges to moving the cutoff earlier even by a decade or two, due
481.3Schristosto the wide variety of local practices before computer timekeeping
491.3Schristosbecame prevalent.
501.1Schristos</p>
511.1Schristos
521.1Schristos<p>
531.4SchristosEach timezone typically corresponds to a geographical region that is
541.4Schristossmaller than a traditional time zone, because clocks in a timezone
551.4Schristosall agree after 1970 whereas a traditional time zone merely
561.4Schristosspecifies current standard time. For example, applications that deal
571.4Schristoswith current and future timestamps in the traditional North
581.4SchristosAmerican mountain time zone can choose from the timezones
591.4Schristos<code>America/Denver</code> which observes US-style daylight saving
601.4Schristostime, <code>America/Mazatlan</code> which observes Mexican-style DST,
611.4Schristosand <code>America/Phoenix</code> which does not observe DST.
621.4SchristosApplications that also deal with past timestamps in the mountain time
631.4Schristoszone can choose from over a dozen timezones, such as
641.4Schristos<code>America/Boise</code>, <code>America/Edmonton</code>, and
651.4Schristos<code>America/Hermosillo</code>, each of which currently uses mountain
661.4Schristostime but differs from other timezones for some timestamps after 1970.
671.4Schristos</p>
681.4Schristos
691.4Schristos<p>
701.4SchristosClock transitions before 1970 are recorded for each timezone,
711.1Schristosbecause most systems support timestamps before 1970 and could
721.1Schristosmisbehave if data entries were omitted for pre-1970 transitions.
731.1SchristosHowever, the database is not designed for and does not suffice for
741.1Schristosapplications requiring accurate handling of all past times everywhere,
751.1Schristosas it would take far too much effort and guesswork to record all
761.1Schristosdetails of pre-1970 civil timekeeping.
771.3SchristosAlthough some information outside the scope of the database is
781.2Schristoscollected in a file <code>backzone</code> that is distributed along
791.2Schristoswith the database proper, this file is less reliable and does not
801.2Schristosnecessarily follow database guidelines.
811.1Schristos</p>
821.1Schristos
831.1Schristos<p>
841.3SchristosAs described below, reference source code for using the
851.3Schristos<code><abbr>tz</abbr></code> database is also available.
861.3SchristosThe <code><abbr>tz</abbr></code> code is upwards compatible with <a
871.3Schristoshref="https://en.wikipedia.org/wiki/POSIX">POSIX</a>, an international
881.3Schristosstandard for <a
891.3Schristoshref="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems.
901.3SchristosAs of this writing, the current edition of POSIX is: <a
911.3Schristoshref="http://pubs.opengroup.org/onlinepubs/9699919799/"> The Open
921.3SchristosGroup Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018
931.3SchristosEdition.
941.3SchristosBecause the database's scope encompasses real-world changes to civil
951.3Schristostimekeeping, its model for describing time is more complex than the
961.3Schristosstandard and daylight saving times supported by POSIX.
971.4SchristosA <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can
981.3Schristoshave more than two changes per year, these changes need not merely
991.3Schristosflip back and forth between two alternatives, and the rules themselves
1001.3Schristoscan change at times.
1011.4SchristosWhether and when a timezone changes its
1021.4Schristosclock, and even the timezone's notional base offset from UTC, are variable.
1031.4SchristosIt does not always make sense to talk about a timezone's
1041.4Schristos"base offset", which is not necessarily a single number.
1051.1Schristos</p>
1061.1Schristos
1071.3Schristos</section>
1081.1Schristos
1091.3Schristos<section>
1101.4Schristos  <h2 id="naming">Names of timezones</h2>
1111.1Schristos<p>
1121.4SchristosEach timezone has a unique name.
1131.1SchristosInexperienced users are not expected to select these names unaided.
1141.1SchristosDistributors should provide documentation and/or a simple selection
1151.4Schristosinterface that explains each name via a map or via descriptive text like
1161.4Schristos"Ruthenia" instead of the timezone name "<code>Europe/Uzhgorod</code>".
1171.4SchristosIf geolocation information is available, a selection interface can
1181.4Schristoslocate the user on a timezone map or prioritize names that are
1191.4Schristosgeographically close. For an example selection interface, see the
1201.3Schristos<code>tzselect</code> program in the <code><abbr>tz</abbr></code> code.
1211.3SchristosThe <a href="http://cldr.unicode.org/">Unicode Common Locale Data
1221.3SchristosRepository</a> contains data that may be useful for other selection
1231.4Schristosinterfaces; it maps timezone names like <code>Europe/Uzhgorod</code>
1241.4Schristosto CLDR names like <code>uauzh</code> which are in turn mapped to
1251.4Schristoslocale-dependent strings like "Uzhhorod", "Ungvár", "Ужгород", and
1261.4Schristos"乌日哥罗德".
1271.1Schristos</p>
1281.1Schristos
1291.1Schristos<p>
1301.3SchristosThe naming conventions attempt to strike a balance
1311.1Schristosamong the following goals:
1321.1Schristos</p>
1331.3Schristos
1341.1Schristos<ul>
1351.1Schristos  <li>
1361.4Schristos    Uniquely identify every timezone where clocks have agreed since 1970.
1371.3Schristos    This is essential for the intended use: static clocks keeping local
1381.3Schristos    civil time.
1391.1Schristos  </li>
1401.1Schristos  <li>
1411.4Schristos    Indicate to experts where the timezone's clocks typically are.
1421.1Schristos  </li>
1431.1Schristos  <li>
1441.3Schristos    Be robust in the presence of political changes.
1451.3Schristos    For example, names of countries are ordinarily not used, to avoid
1461.3Schristos    incompatibilities when countries change their name (e.g.,
1471.3Schristos    Zaire&rarr;Congo) or when locations change countries (e.g., Hong
1481.3Schristos    Kong from UK colony to China).
1491.1Schristos  </li>
1501.1Schristos  <li>
1511.3Schristos    Be portable to a wide variety of implementations.
1521.1Schristos  </li>
1531.1Schristos  <li>
1541.3Schristos    Use a consistent naming conventions over the entire world.
1551.1Schristos  </li>
1561.1Schristos</ul>
1571.3Schristos
1581.1Schristos<p>
1591.3SchristosNames normally have the form
1601.3Schristos<var>AREA</var><code>/</code><var>LOCATION</var>, where
1611.4Schristos<var>AREA</var> is a continent or ocean, and
1621.4Schristos<var>LOCATION</var> is a specific location within the area.
1631.3SchristosNorth and South America share the same area, '<code>America</code>'.
1641.3SchristosTypical names are '<code>Africa/Cairo</code>',
1651.3Schristos'<code>America/New_York</code>', and '<code>Pacific/Honolulu</code>'.
1661.3SchristosSome names are further qualified to help avoid confusion; for example,
1671.3Schristos'<code>America/Indiana/Petersburg</code>' distinguishes Petersburg,
1681.3SchristosIndiana from other Petersburgs in America.
1691.1Schristos</p>
1701.1Schristos
1711.1Schristos<p>
1721.3SchristosHere are the general guidelines used for
1731.4Schristoschoosing timezone names,
1741.1Schristosin decreasing order of importance:
1751.1Schristos</p>
1761.3Schristos
1771.1Schristos<ul>
1781.1Schristos  <li>
1791.3Schristos    Use only valid POSIX file name components (i.e., the parts of
1801.3Schristos    names other than '<code>/</code>').
1811.3Schristos    Do not use the file name components '<code>.</code>' and
1821.3Schristos    '<code>..</code>'.
1831.3Schristos    Within a file name component, use only <a
1841.3Schristos    href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters,
1851.3Schristos    '<code>.</code>', '<code>-</code>' and '<code>_</code>'.
1861.3Schristos    Do not use digits, as that might create an ambiguity with <a
1871.3Schristos    href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX
1881.3Schristos    <code>TZ</code> strings</a>.
1891.3Schristos    A file name component must not exceed 14 characters or start with
1901.3Schristos    '<code>-</code>'.
1911.3Schristos    E.g., prefer <code>Asia/Brunei</code> to
1921.3Schristos    <code>Asia/Bandar_Seri_Begawan</code>.
1931.3Schristos    Exceptions: see the discussion of legacy names below.
1941.1Schristos  </li>
1951.1Schristos  <li>
1961.3Schristos    A name must not be empty, or contain '<code>//</code>', or
1971.3Schristos    start or end with '<code>/</code>'.
1981.1Schristos  </li>
1991.1Schristos  <li>
2001.3Schristos    Do not use names that differ only in case.
2011.3Schristos    Although the reference implementation is case-sensitive, some
2021.3Schristos    other implementations are not, and they would mishandle names
2031.3Schristos    differing only in case.
2041.1Schristos  </li>
2051.1Schristos  <li>
2061.3Schristos    If one name <var>A</var> is an initial prefix of another
2071.3Schristos    name <var>AB</var> (ignoring case), then <var>B</var> must not
2081.3Schristos    start with '<code>/</code>', as a regular file cannot have the
2091.3Schristos    same name as a directory in POSIX.
2101.3Schristos    For example, <code>America/New_York</code> precludes
2111.3Schristos    <code>America/New_York/Bronx</code>.
2121.1Schristos  </li>
2131.1Schristos  <li>
2141.3Schristos    Uninhabited regions like the North Pole and Bouvet Island
2151.3Schristos    do not need locations, since local time is not defined there.
2161.1Schristos  </li>
2171.1Schristos  <li>
2181.3Schristos    There should typically be at least one name for each <a
2191.3Schristos    href="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr
2201.3Schristos    title="International Organization for Standardization">ISO</abbr>
2211.3Schristos    3166-1</a> officially assigned two-letter code for an inhabited
2221.3Schristos    country or territory.
2231.1Schristos  </li>
2241.1Schristos  <li>
2251.4Schristos    If all the clocks in a timezone have agreed since 1970,
2261.4Schristos    do not bother to include more than one timezone
2271.4Schristos    even if some of the clocks disagreed before 1970.
2281.3Schristos    Otherwise these tables would become annoyingly large.
2291.1Schristos  </li>
2301.1Schristos  <li>
2311.3Schristos    If a name is ambiguous, use a less ambiguous alternative;
2321.3Schristos    e.g., many cities are named San José and Georgetown, so
2331.3Schristos    prefer <code>America/Costa_Rica</code> to
2341.3Schristos    <code>America/San_Jose</code> and <code>America/Guyana</code>
2351.3Schristos    to <code>America/Georgetown</code>.
2361.1Schristos  </li>
2371.1Schristos  <li>
2381.3Schristos    Keep locations compact.
2391.3Schristos    Use cities or small islands, not countries or regions, so that any
2401.3Schristos    future changes do not split individual locations into different
2411.4Schristos    timezones.
2421.3Schristos    E.g., prefer <code>Europe/Paris</code> to <code>Europe/France</code>,
2431.3Schristos    since
2441.3Schristos    <a href="https://en.wikipedia.org/wiki/Time_in_France#History">France
2451.3Schristos    has had multiple time zones</a>.
2461.1Schristos  </li>
2471.1Schristos  <li>
2481.3Schristos    Use mainstream English spelling, e.g., prefer
2491.4Schristos    <code>Europe/Rome</code> to <code>Europa/Roma</code>, and
2501.3Schristos    prefer <code>Europe/Athens</code> to the Greek
2511.4Schristos    <code>Ευρώπη/Αθήνα</code> or the Romanized
2521.4Schristos    <code>Evrópi/Athína</code>.
2531.3Schristos    The POSIX file name restrictions encourage this guideline.
2541.1Schristos  </li>
2551.1Schristos  <li>
2561.3Schristos    Use the most populous among locations in a region,
2571.3Schristos    e.g., prefer <code>Asia/Shanghai</code> to
2581.3Schristos    <code>Asia/Beijing</code>.
2591.3Schristos    Among locations with similar populations, pick the best-known
2601.3Schristos    location, e.g., prefer <code>Europe/Rome</code> to
2611.3Schristos    <code>Europe/Milan</code>.
2621.1Schristos  </li>
2631.1Schristos  <li>
2641.3Schristos    Use the singular form, e.g., prefer <code>Atlantic/Canary</code> to
2651.3Schristos    <code>Atlantic/Canaries</code>.
2661.1Schristos  </li>
2671.1Schristos  <li>
2681.3Schristos    Omit common suffixes like '<code>_Islands</code>' and
2691.3Schristos    '<code>_City</code>', unless that would lead to ambiguity.
2701.3Schristos    E.g., prefer <code>America/Cayman</code> to
2711.3Schristos    <code>America/Cayman_Islands</code> and
2721.3Schristos    <code>America/Guatemala</code> to
2731.3Schristos    <code>America/Guatemala_City</code>, but prefer
2741.3Schristos    <code>America/Mexico_City</code> to
2751.3Schristos    <code>America/Mexico</code>
2761.3Schristos    because <a href="https://en.wikipedia.org/wiki/Time_in_Mexico">the
2771.3Schristos    country of Mexico has several time zones</a>.
2781.1Schristos  </li>
2791.1Schristos  <li>
2801.3Schristos    Use '<code>_</code>' to represent a space.
2811.1Schristos  </li>
2821.1Schristos  <li>
2831.3Schristos    Omit '<code>.</code>' from abbreviations in names.
2841.3Schristos    E.g., prefer <code>Atlantic/St_Helena</code> to
2851.3Schristos    <code>Atlantic/St._Helena</code>.
2861.1Schristos  </li>
2871.1Schristos  <li>
2881.3Schristos    Do not change established names if they only marginally violate
2891.3Schristos    the above guidelines.
2901.3Schristos    For example, do not change the existing name <code>Europe/Rome</code> to
2911.3Schristos    <code>Europe/Milan</code> merely because Milan's population has grown
2921.3Schristos    to be somewhat greater than Rome's.
2931.1Schristos  </li>
2941.1Schristos  <li>
2951.3Schristos    If a name is changed, put its old spelling in the
2961.3Schristos    '<code>backward</code>' file.
2971.3Schristos    This means old spellings will continue to work.
2981.1Schristos  </li>
2991.1Schristos</ul>
3001.1Schristos
3011.1Schristos<p>
3021.1SchristosThe file '<code>zone1970.tab</code>' lists geographical locations used
3031.4Schristosto name timezones.
3041.3SchristosIt is intended to be an exhaustive list of names for geographic
3051.4Schristosregions as described above; this is a subset of the timezones in the data.
3061.3SchristosAlthough a '<code>zone1970.tab</code>' location's
3071.3Schristos<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
3081.3Schristoscorresponds to
3091.3Schristosits <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean
3101.3Schristostime (<abbr>LMT</abbr>)</a> offset with one hour for every 15&deg;
3111.3Schristoseast longitude, this relationship is not exact.
3121.1Schristos</p>
3131.1Schristos
3141.1Schristos<p>
3151.1SchristosOlder versions of this package used a different naming scheme,
3161.1Schristosand these older names are still supported.
3171.1SchristosSee the file '<code>backward</code>' for most of these older names
3181.1Schristos(e.g., '<code>US/Eastern</code>' instead of '<code>America/New_York</code>').
3191.1SchristosThe other old-fashioned names still supported are
3201.3Schristos'<code>WET</code>', '<code>CET</code>', '<code>MET</code>', and
3211.3Schristos'<code>EET</code>' (see the file '<code>europe</code>').
3221.1Schristos</p>
3231.1Schristos
3241.1Schristos<p>
3251.1SchristosOlder versions of this package defined legacy names that are
3261.3Schristosincompatible with the first guideline of location names, but which are
3271.3Schristosstill supported.
3281.3SchristosThese legacy names are mostly defined in the file
3291.3Schristos'<code>etcetera</code>'.
3301.3SchristosAlso, the file '<code>backward</code>' defines the legacy names
3311.3Schristos'<code>GMT0</code>', '<code>GMT-0</code>' and '<code>GMT+0</code>',
3321.3Schristosand the file '<code>northamerica</code>' defines the legacy names
3331.3Schristos'<code>EST5EDT</code>', '<code>CST6CDT</code>',
3341.3Schristos'<code>MST7MDT</code>', and '<code>PST8PDT</code>'.
3351.1Schristos</p>
3361.1Schristos
3371.1Schristos<p>
3381.3SchristosExcluding '<code>backward</code>' should not affect the other data.
3391.3SchristosIf '<code>backward</code>' is excluded, excluding
3401.3Schristos'<code>etcetera</code>' should not affect the remaining data.
3411.1Schristos</p>
3421.3Schristos</section>
3431.1Schristos
3441.3Schristos<section>
3451.3Schristos  <h2 id="abbreviations">Time zone abbreviations</h2>
3461.1Schristos<p>
3471.1SchristosWhen this package is installed, it generates time zone abbreviations
3481.1Schristoslike '<code>EST</code>' to be compatible with human tradition and POSIX.
3491.3SchristosHere are the general guidelines used for choosing time zone abbreviations,
3501.1Schristosin decreasing order of importance:
3511.3Schristos</p>
3521.3Schristos
3531.1Schristos<ul>
3541.1Schristos  <li>
3551.3Schristos    Use three to six characters that are ASCII alphanumerics or
3561.3Schristos    '<code>+</code>' or '<code>-</code>'.
3571.3Schristos    Previous editions of this database also used characters like
3581.3Schristos    space and '<code>?</code>', but these characters have a
3591.3Schristos    special meaning to the
3601.3Schristos    <a href="https://en.wikipedia.org/wiki/Unix_shell">UNIX shell</a>
3611.3Schristos    and cause commands like
3621.3Schristos    '<code><a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a>
3631.3Schristos    `<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>'
3641.3Schristos    to have unexpected effects.
3651.3Schristos    Previous editions of this guideline required upper-case letters, but the
3661.3Schristos    Congressman who introduced
3671.3Schristos    <a href="https://en.wikipedia.org/wiki/Chamorro_Time_Zone">Chamorro
3681.3Schristos    Standard Time</a> preferred "ChST", so lower-case letters are now
3691.3Schristos    allowed.
3701.3Schristos    Also, POSIX from 2001 on relaxed the rule to allow '<code>-</code>',
3711.3Schristos    '<code>+</code>', and alphanumeric characters from the portable
3721.3Schristos    character set in the current locale.
3731.3Schristos    In practice ASCII alphanumerics and '<code>+</code>' and
3741.3Schristos    '<code>-</code>' are safe in all locales.
3751.3Schristos
3761.3Schristos    <p>
3771.3Schristos    In other words, in the C locale the POSIX extended regular
3781.3Schristos    expression <code>[-+[:alnum:]]{3,6}</code> should match the
3791.3Schristos    abbreviation.
3801.3Schristos    This guarantees that all abbreviations could have been specified by a
3811.3Schristos    POSIX <code>TZ</code> string.
3821.3Schristos    </p>
3831.3Schristos  </li>
3841.3Schristos  <li>
3851.3Schristos    Use abbreviations that are in common use among English-speakers,
3861.3Schristos    e.g., 'EST' for Eastern Standard Time in North America.
3871.3Schristos    We assume that applications translate them to other languages
3881.3Schristos    as part of the normal localization process; for example,
3891.3Schristos    a French application might translate 'EST' to 'HNE'.
3901.3Schristos
3911.3Schristos    <p>
3921.3Schristos    <small>These abbreviations (for standard/daylight/etc. time) are:
3931.3Schristos      ACST/ACDT Australian Central,
3941.3Schristos      AST/ADT/APT/AWT/ADDT Atlantic,
3951.3Schristos      AEST/AEDT Australian Eastern,
3961.3Schristos      AHST/AHDT Alaska-Hawaii,
3971.3Schristos      AKST/AKDT Alaska,
3981.3Schristos      AWST/AWDT Australian Western,
3991.3Schristos      BST/BDT Bering,
4001.3Schristos      CAT/CAST Central Africa,
4011.3Schristos      CET/CEST/CEMT Central European,
4021.3Schristos      ChST Chamorro,
4031.3Schristos      CST/CDT/CWT/CPT/CDDT Central [North America],
4041.3Schristos      CST/CDT China,
4051.3Schristos      GMT/BST/IST/BDST Greenwich,
4061.3Schristos      EAT East Africa,
4071.3Schristos      EST/EDT/EWT/EPT/EDDT Eastern [North America],
4081.3Schristos      EET/EEST Eastern European,
4091.3Schristos      GST Guam,
4101.3Schristos      HST/HDT Hawaii,
4111.3Schristos      HKT/HKST Hong Kong,
4121.3Schristos      IST India,
4131.3Schristos      IST/GMT Irish,
4141.3Schristos      IST/IDT/IDDT Israel,
4151.3Schristos      JST/JDT Japan,
4161.3Schristos      KST/KDT Korea,
4171.3Schristos      MET/MEST Middle European (a backward-compatibility alias for
4181.3Schristos	Central European),
4191.3Schristos      MSK/MSD Moscow,
4201.3Schristos      MST/MDT/MWT/MPT/MDDT Mountain,
4211.3Schristos      NST/NDT/NWT/NPT/NDDT Newfoundland,
4221.3Schristos      NST/NDT/NWT/NPT Nome,
4231.3Schristos      NZMT/NZST New Zealand through 1945,
4241.3Schristos      NZST/NZDT New Zealand 1946&ndash;present,
4251.3Schristos      PKT/PKST Pakistan,
4261.3Schristos      PST/PDT/PWT/PPT/PDDT Pacific,
4271.4Schristos      PST/PDT Philippine,
4281.3Schristos      SAST South Africa,
4291.3Schristos      SST Samoa,
4301.3Schristos      WAT/WAST West Africa,
4311.3Schristos      WET/WEST/WEMT Western European,
4321.3Schristos      WIB Waktu Indonesia Barat,
4331.3Schristos      WIT Waktu Indonesia Timur,
4341.3Schristos      WITA Waktu Indonesia Tengah,
4351.3Schristos      YST/YDT/YWT/YPT/YDDT Yukon</small>.
4361.3Schristos    </p>
4371.3Schristos  </li>
4381.3Schristos  <li>
4391.3Schristos    <p>
4401.3Schristos    For times taken from a city's longitude, use the
4411.3Schristos    traditional <var>x</var>MT notation.
4421.3Schristos    The only abbreviation like this in current use is '<abbr>GMT</abbr>'.
4431.3Schristos    The others are for timestamps before 1960,
4441.3Schristos    except that Monrovia Mean Time persisted until 1972.
4451.3Schristos    Typically, numeric abbreviations (e.g., '<code>-</code>004430' for
4461.3Schristos    MMT) would cause trouble here, as the numeric strings would exceed
4471.3Schristos    the POSIX length limit.
4481.3Schristos    </p>
4491.3Schristos
4501.3Schristos    <p>
4511.3Schristos    <small>These abbreviations are:
4521.3Schristos      AMT Amsterdam, Asunción, Athens;
4531.3Schristos      BMT Baghdad, Bangkok, Batavia, Bern, Bogotá, Bridgetown, Brussels,
4541.3Schristos	Bucharest;
4551.3Schristos      CMT Calamarca, Caracas, Chisinau, Colón, Copenhagen, Córdoba;
4561.3Schristos      DMT Dublin/Dunsink;
4571.3Schristos      EMT Easter;
4581.3Schristos      FFMT Fort-de-France;
4591.3Schristos      FMT Funchal;
4601.3Schristos      GMT Greenwich;
4611.3Schristos      HMT Havana, Helsinki, Horta, Howrah;
4621.3Schristos      IMT Irkutsk, Istanbul;
4631.3Schristos      JMT Jerusalem;
4641.3Schristos      KMT Kaunas, Kiev, Kingston;
4651.3Schristos      LMT Lima, Lisbon, local, Luanda;
4661.3Schristos      MMT Macassar, Madras, Malé, Managua, Minsk, Monrovia, Montevideo,
4671.3Schristos	Moratuwa, Moscow;
4681.3Schristos      PLMT Phù Liễn;
4691.3Schristos      PMT Paramaribo, Paris, Perm, Pontianak, Prague;
4701.3Schristos      PMMT Port Moresby;
4711.3Schristos      QMT Quito;
4721.3Schristos      RMT Rangoon, Riga, Rome;
4731.3Schristos      SDMT Santo Domingo;
4741.3Schristos      SJMT San José;
4751.3Schristos      SMT Santiago, Simferopol, Singapore, Stanley;
4761.3Schristos      TBMT Tbilisi;
4771.3Schristos      TMT Tallinn, Tehran;
4781.3Schristos      WMT Warsaw</small>.
4791.3Schristos    </p>
4801.3Schristos
4811.3Schristos    <p>
4821.3Schristos    <small>A few abbreviations also follow the pattern that
4831.4Schristos    <abbr>GMT</abbr>/<abbr>BST</abbr> established for time in the UK.
4841.3Schristos    They are:
4851.3Schristos      CMT/BST for Calamarca Mean Time and Bolivian Summer Time
4861.3Schristos	1890&ndash;1932,
4871.3Schristos      DMT/IST for Dublin/Dunsink Mean Time and Irish Summer Time
4881.3Schristos	1880&ndash;1916,
4891.3Schristos      MMT/MST/MDST for Moscow 1880&ndash;1919, and
4901.3Schristos      RMT/LST for Riga Mean Time and Latvian Summer time 1880&ndash;1926.
4911.3Schristos    An extra-special case is SET for Swedish Time (<em>svensk
4921.3Schristos    normaltid</em>) 1879&ndash;1899, 3&deg; west of the Stockholm
4931.3Schristos    Observatory.</small>
4941.3Schristos    </p>
4951.3Schristos  </li>
4961.3Schristos  <li>
4971.3Schristos    Use '<abbr>LMT</abbr>' for local mean time of locations before the
4981.3Schristos    introduction of standard time; see "<a href="#scope">Scope of the
4991.3Schristos    <code><abbr>tz</abbr></code> database</a>".
5001.3Schristos  </li>
5011.3Schristos  <li>
5021.3Schristos    If there is no common English abbreviation, use numeric offsets like
5031.4Schristos    <code>-</code>05 and <code>+</code>0530 that are generated
5041.3Schristos    by <code>zic</code>'s <code>%z</code> notation.
5051.3Schristos  </li>
5061.3Schristos  <li>
5071.3Schristos    Use current abbreviations for older timestamps to avoid confusion.
5081.3Schristos    For example, in 1910 a common English abbreviation for time
5091.3Schristos    in central Europe was 'MEZ' (short for both "Middle European
5101.3Schristos    Zone" and for "Mitteleuropäische Zeit" in German).
5111.3Schristos    Nowadays 'CET' ("Central European Time") is more common in
5121.3Schristos    English, and the database uses 'CET' even for circa-1910
5131.3Schristos    timestamps as this is less confusing for modern users and avoids
5141.3Schristos    the need for determining when 'CET' supplanted 'MEZ' in common
5151.3Schristos    usage.
5161.3Schristos  </li>
5171.3Schristos  <li>
5181.4Schristos    Use a consistent style in a timezone's history.
5191.4Schristos    For example, if a history tends to use numeric
5201.3Schristos    abbreviations and a particular entry could go either way, use a
5211.3Schristos    numeric abbreviation.
5221.3Schristos  </li>
5231.3Schristos  <li>
5241.3Schristos    Use
5251.3Schristos    <a href="https://en.wikipedia.org/wiki/Universal_Time">Universal Time</a>
5261.3Schristos    (<abbr>UT</abbr>) (with time zone abbreviation '<code>-</code>00') for
5271.3Schristos    locations while uninhabited.
5281.3Schristos    The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in
5291.3Schristos    some sense undefined; this notation is derived
5301.3Schristos    from <a href="https://tools.ietf.org/html/rfc3339">Internet
5311.4Schristos    <abbr title="Request For Comments">RFC</abbr> 3339</a>.
5321.1Schristos  </li>
5331.1Schristos</ul>
5341.3Schristos
5351.1Schristos<p>
5361.1SchristosApplication writers should note that these abbreviations are ambiguous
5371.2Schristosin practice: e.g., 'CST' means one thing in China and something else
5381.2Schristosin North America, and 'IST' can refer to time in India, Ireland or
5391.3SchristosIsrael.
5401.3SchristosTo avoid ambiguity, use numeric <abbr>UT</abbr> offsets like
5411.2Schristos'<code>-</code>0600' instead of time zone abbreviations like 'CST'.
5421.1Schristos</p>
5431.3Schristos</section>
5441.1Schristos
5451.3Schristos<section>
5461.3Schristos  <h2 id="accuracy">Accuracy of the <code><abbr>tz</abbr></code> database</h2>
5471.1Schristos<p>
5481.3SchristosThe <code><abbr>tz</abbr></code> database is not authoritative, and it
5491.3Schristossurely has errors.
5501.2SchristosCorrections are welcome and encouraged; see the file <code>CONTRIBUTING</code>.
5511.1SchristosUsers requiring authoritative data should consult national standards
5521.1Schristosbodies and the references cited in the database's comments.
5531.1Schristos</p>
5541.1Schristos
5551.1Schristos<p>
5561.3SchristosErrors in the <code><abbr>tz</abbr></code> database arise from many sources:
5571.1Schristos</p>
5581.3Schristos
5591.1Schristos<ul>
5601.1Schristos  <li>
5611.3Schristos    The <code><abbr>tz</abbr></code> database predicts future
5621.3Schristos    timestamps, and current predictions
5631.3Schristos    will be incorrect after future governments change the rules.
5641.3Schristos    For example, if today someone schedules a meeting for 13:00 next
5651.3Schristos    October 1, Casablanca time, and tomorrow Morocco changes its
5661.3Schristos    daylight saving rules, software can mess up after the rule change
5671.3Schristos    if it blithely relies on conversions made before the change.
5681.3Schristos  </li>
5691.3Schristos  <li>
5701.3Schristos    The pre-1970 entries in this database cover only a tiny sliver of how
5711.3Schristos    clocks actually behaved; the vast majority of the necessary
5721.3Schristos    information was lost or never recorded.
5731.4Schristos    Thousands more timezones would be needed if
5741.3Schristos    the <code><abbr>tz</abbr></code> database's scope were extended to
5751.3Schristos    cover even just the known or guessed history of standard time; for
5761.3Schristos    example, the current single entry for France would need to split
5771.3Schristos    into dozens of entries, perhaps hundreds.
5781.3Schristos    And in most of the world even this approach would be misleading
5791.3Schristos    due to widespread disagreement or indifference about what times
5801.3Schristos    should be observed.
5811.3Schristos    In her 2015 book
5821.3Schristos    <cite><a
5831.3Schristos    href="http://www.hup.harvard.edu/catalog.php?isbn=9780674286146">The
5841.3Schristos    Global Transformation of Time, 1870&ndash;1950</a></cite>,
5851.3Schristos    Vanessa Ogle writes
5861.3Schristos    "Outside of Europe and North America there was no system of time
5871.3Schristos    zones at all, often not even a stable landscape of mean times,
5881.3Schristos    prior to the middle decades of the twentieth century".
5891.3Schristos    See: Timothy Shenk, <a
5901.3Schristoshref="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle">Booked:
5911.3Schristos      A Global History of Time</a>. <cite>Dissent</cite> 2015-12-17.
5921.3Schristos  </li>
5931.3Schristos  <li>
5941.3Schristos    Most of the pre-1970 data entries come from unreliable sources, often
5951.3Schristos    astrology books that lack citations and whose compilers evidently
5961.3Schristos    invented entries when the true facts were unknown, without
5971.3Schristos    reporting which entries were known and which were invented.
5981.3Schristos    These books often contradict each other or give implausible entries,
5991.3Schristos    and on the rare occasions when they are checked they are
6001.3Schristos    typically found to be incorrect.
6011.3Schristos  </li>
6021.3Schristos  <li>
6031.3Schristos    For the UK the <code><abbr>tz</abbr></code> database relies on
6041.3Schristos    years of first-class work done by
6051.3Schristos    Joseph Myers and others; see
6061.3Schristos    "<a href="https://www.polyomino.org.uk/british-time/">History of
6071.3Schristos    legal time in Britain</a>".
6081.3Schristos    Other countries are not done nearly as well.
6091.3Schristos  </li>
6101.3Schristos  <li>
6111.3Schristos    Sometimes, different people in the same city maintain clocks
6121.3Schristos    that differ significantly.
6131.3Schristos    Historically, railway time was used by railroad companies (which
6141.3Schristos    did not always
6151.3Schristos    agree with each other), church-clock time was used for birth
6161.3Schristos    certificates, etc.
6171.3Schristos    More recently, competing political groups might disagree about
6181.3Schristos    clock settings. Often this is merely common practice, but
6191.3Schristos    sometimes it is set by law.
6201.3Schristos    For example, from 1891 to 1911 the <abbr>UT</abbr> offset in France
6211.3Schristos    was legally <abbr>UT</abbr> +00:09:21 outside train stations and
6221.3Schristos    <abbr>UT</abbr> +00:04:21 inside. Other examples include
6231.3Schristos    Chillicothe in 1920, Palm Springs in 1946/7, and Jerusalem and
6241.3Schristos    Ürümqi to this day.
6251.3Schristos  </li>
6261.3Schristos  <li>
6271.3Schristos    Although a named location in the <code><abbr>tz</abbr></code>
6281.3Schristos    database stands for the containing region, its pre-1970 data
6291.3Schristos    entries are often accurate for only a small subset of that region.
6301.3Schristos    For example, <code>Europe/London</code> stands for the United
6311.3Schristos    Kingdom, but its pre-1847 times are valid only for locations that
6321.3Schristos    have London's exact meridian, and its 1847 transition
6331.3Schristos    to <abbr>GMT</abbr> is known to be valid only for the L&amp;NW and
6341.3Schristos    the Caledonian railways.
6351.3Schristos  </li>
6361.3Schristos  <li>
6371.3Schristos    The <code><abbr>tz</abbr></code> database does not record the
6381.4Schristos    earliest time for which a timezone's
6391.3Schristos    data entries are thereafter valid for every location in the region.
6401.3Schristos    For example, <code>Europe/London</code> is valid for all locations
6411.3Schristos    in its region after <abbr>GMT</abbr> was made the standard time,
6421.3Schristos    but the date of standardization (1880-08-02) is not in the
6431.3Schristos    <code><abbr>tz</abbr></code> database, other than in commentary.
6441.4Schristos    For many timezones the earliest time of
6451.3Schristos    validity is unknown.
6461.3Schristos  </li>
6471.3Schristos  <li>
6481.3Schristos    The <code><abbr>tz</abbr></code> database does not record a
6491.3Schristos    region's boundaries, and in many cases the boundaries are not known.
6501.4Schristos    For example, the timezone
6511.3Schristos    <code>America/Kentucky/Louisville</code> represents a region
6521.3Schristos    around the city of Louisville, the boundaries of which are
6531.3Schristos    unclear.
6541.3Schristos  </li>
6551.3Schristos  <li>
6561.3Schristos    Changes that are modeled as instantaneous transitions in the
6571.3Schristos    <code><abbr>tz</abbr></code>
6581.3Schristos    database were often spread out over hours, days, or even decades.
6591.3Schristos  </li>
6601.3Schristos  <li>
6611.3Schristos    Even if the time is specified by law, locations sometimes
6621.3Schristos    deliberately flout the law.
6631.3Schristos  </li>
6641.3Schristos  <li>
6651.3Schristos    Early timekeeping practices, even assuming perfect clocks, were
6661.3Schristos    often not specified to the accuracy that the
6671.3Schristos    <code><abbr>tz</abbr></code> database requires.
6681.3Schristos  </li>
6691.3Schristos  <li>
6701.3Schristos    Sometimes historical timekeeping was specified more precisely
6711.3Schristos    than what the <code><abbr>tz</abbr></code> code can handle.
6721.3Schristos    For example, from 1909 to 1937 <a
6731.3Schristos    href="https://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm"
6741.3Schristos    hreflang="nl">Netherlands clocks</a> were legally Amsterdam Mean
6751.3Schristos    Time (estimated to be <abbr>UT</abbr>
6761.3Schristos    +00:19:32.13), but the <code><abbr>tz</abbr></code>
6771.3Schristos    code cannot represent the fractional second.
6781.3Schristos    In practice these old specifications were rarely if ever
6791.3Schristos    implemented to subsecond precision.
6801.3Schristos  </li>
6811.3Schristos  <li>
6821.3Schristos    Even when all the timestamp transitions recorded by the
6831.3Schristos    <code><abbr>tz</abbr></code> database are correct, the
6841.3Schristos    <code><abbr>tz</abbr></code> rules that generate them may not
6851.3Schristos    faithfully reflect the historical rules.
6861.3Schristos    For example, from 1922 until World War II the UK moved clocks
6871.3Schristos    forward the day following the third Saturday in April unless that
6881.3Schristos    was Easter, in which case it moved clocks forward the previous
6891.3Schristos    Sunday.
6901.3Schristos    Because the <code><abbr>tz</abbr></code> database has no
6911.3Schristos    way to specify Easter, these exceptional years are entered as
6921.3Schristos    separate <code><abbr>tz</abbr> Rule</code> lines, even though the
6931.3Schristos    legal rules did not change.
6941.4Schristos    When transitions are known but the historical rules behind them are not,
6951.4Schristos    the database contains <code>Zone</code> and <code>Rule</code>
6961.4Schristos    entries that are intended to represent only the generated
6971.4Schristos    transitions, not any underlying historical rules; however, this
6981.4Schristos    intent is recorded at best only in commentary.
6991.3Schristos  </li>
7001.3Schristos  <li>
7011.4Schristos    The <code><abbr>tz</abbr></code> database models time
7021.3Schristos    using the <a
7031.3Schristos    href="https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">proleptic
7041.4Schristos    Gregorian calendar</a> with days containing 24 equal-length hours
7051.4Schristos    numbered 00 through 23, except when clock transitions occur.
7061.4Schristos    Pre-standard time is modeled as local mean time.
7071.4Schristos    However, historically many people used other calendars and other timescales.
7081.3Schristos    For example, the Roman Empire used
7091.3Schristos    the <a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian
7101.3Schristos    calendar</a>,
7111.3Schristos    and <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">Roman
7121.3Schristos    timekeeping</a> had twelve varying-length daytime hours with a
7131.3Schristos    non-hour-based system at night.
7141.4Schristos    And even today, some local practices diverge from the Gregorian
7151.4Schristos    calendar with 24-hour days. These divergences range from
7161.4Schristos    relatively minor, such as Japanese bars giving times like "24:30" for the
7171.4Schristos    wee hours of the morning, to more-significant differences such as <a
7181.4Schristos    href="https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time">the
7191.4Schristos    east African practice of starting the day at dawn</a>, renumbering
7201.4Schristos    the Western 06:00 to be 12:00. These practices are largely outside
7211.4Schristos    the scope of the <code><abbr>tz</abbr></code> code and data, which
7221.4Schristos    provide only limited support for date and time localization
7231.4Schristos    such as that required by POSIX. If DST is not used a different time zone
7241.4Schristos    can often do the trick; for example, in Kenya a <code>TZ</code> setting
7251.4Schristos    like <code>&lt;-03&gt;3</code> or <code>America/Cayenne</code> starts
7261.4Schristos    the day six hours later than <code>Africa/Nairobi</code> does.
7271.3Schristos  </li>
7281.3Schristos  <li>
7291.3Schristos    Early clocks were less reliable, and data entries do not represent
7301.3Schristos    clock error.
7311.3Schristos  </li>
7321.3Schristos  <li>
7331.3Schristos    The <code><abbr>tz</abbr></code> database assumes Universal Time
7341.3Schristos    (<abbr>UT</abbr>) as an origin, even though <abbr>UT</abbr> is not
7351.3Schristos    standardized for older timestamps.
7361.3Schristos    In the <code><abbr>tz</abbr></code> database commentary,
7371.3Schristos    <abbr>UT</abbr> denotes a family of time standards that includes
7381.3Schristos    Coordinated Universal Time (<abbr>UTC</abbr>) along with other
7391.3Schristos    variants such as <abbr>UT1</abbr> and <abbr>GMT</abbr>,
7401.3Schristos    with days starting at midnight.
7411.3Schristos    Although <abbr>UT</abbr> equals <abbr>UTC</abbr> for modern
7421.3Schristos    timestamps, <abbr>UTC</abbr> was not defined until 1960, so
7431.3Schristos    commentary uses the more-general abbreviation <abbr>UT</abbr> for
7441.3Schristos    timestamps that might predate 1960.
7451.3Schristos    Since <abbr>UT</abbr>, <abbr>UT1</abbr>, etc. disagree slightly,
7461.3Schristos    and since pre-1972 <abbr>UTC</abbr> seconds varied in length,
7471.3Schristos    interpretation of older timestamps can be problematic when
7481.3Schristos    subsecond accuracy is needed.
7491.3Schristos  </li>
7501.3Schristos  <li>
7511.3Schristos    Civil time was not based on atomic time before 1972, and we do not
7521.3Schristos    know the history of
7531.3Schristos    <a href="https://en.wikipedia.org/wiki/Earth's_rotation">earth's
7541.3Schristos    rotation</a> accurately enough to map <a
7551.3Schristos    href="https://en.wikipedia.org/wiki/International_System_of_Units"><abbr
7561.3Schristos    title="International System of Units">SI</abbr></a> seconds to
7571.3Schristos    historical <a href="https://en.wikipedia.org/wiki/Solar_time">solar time</a>
7581.3Schristos    to more than about one-hour accuracy.
7591.3Schristos    See: Stephenson FR, Morrison LV, Hohenkerk CY.
7601.4Schristos    <a href="https://dx.doi.org/10.1098/rspa.2016.0404">Measurement of
7611.3Schristos    the Earth's rotation: 720 BC to AD 2015</a>.
7621.3Schristos    <cite>Proc Royal Soc A</cite>. 2016 Dec 7;472:20160404.
7631.3Schristos    Also see: Espenak F. <a
7641.3Schristos    href="https://eclipse.gsfc.nasa.gov/SEhelp/uncertainty2004.html">Uncertainty
7651.3Schristos    in Delta T (ΔT)</a>.
7661.3Schristos  </li>
7671.3Schristos  <li>
7681.3Schristos    The relationship between POSIX time (that is, <abbr>UTC</abbr> but
7691.3Schristos    ignoring <a href="https://en.wikipedia.org/wiki/Leap_second">leap
7701.3Schristos    seconds</a>) and <abbr>UTC</abbr> is not agreed upon after 1972.
7711.3Schristos    Although the POSIX
7721.3Schristos    clock officially stops during an inserted leap second, at least one
7731.3Schristos    proposed standard has it jumping back a second instead; and in
7741.3Schristos    practice POSIX clocks more typically either progress glacially during
7751.3Schristos    a leap second, or are slightly slowed while near a leap second.
7761.3Schristos  </li>
7771.3Schristos  <li>
7781.3Schristos    The <code><abbr>tz</abbr></code> database does not represent how
7791.3Schristos    uncertain its information is.
7801.3Schristos    Ideally it would contain information about when data entries are
7811.3Schristos    incomplete or dicey.
7821.3Schristos    Partial temporal knowledge is a field of active research, though,
7831.3Schristos    and it is not clear how to apply it here.
7841.1Schristos  </li>
7851.1Schristos</ul>
7861.1Schristos
7871.1Schristos<p>
7881.3SchristosIn short, many, perhaps most, of the <code><abbr>tz</abbr></code>
7891.3Schristosdatabase's pre-1970 and future timestamps are either wrong or
7901.3Schristosmisleading.
7911.3SchristosAny attempt to pass the
7921.3Schristos<code><abbr>tz</abbr></code> database off as the definition of time
7931.3Schristosshould be unacceptable to anybody who cares about the facts.
7941.3SchristosIn particular, the <code><abbr>tz</abbr></code> database's
7951.3Schristos<abbr>LMT</abbr> offsets should not be considered meaningful, and
7961.4Schristosshould not prompt creation of timezones
7971.3Schristosmerely because two locations
7981.3Schristosdiffer in <abbr>LMT</abbr> or transitioned to standard time at
7991.3Schristosdifferent dates.
8001.3Schristos</p>
8011.3Schristos</section>
8021.3Schristos
8031.3Schristos<section>
8041.3Schristos  <h2 id="functions">Time and date functions</h2>
8051.3Schristos<p>
8061.3SchristosThe <code><abbr>tz</abbr></code> code contains time and date functions
8071.3Schristosthat are upwards compatible with those of POSIX.
8081.3SchristosCode compatible with this package is already
8091.3Schristos<a href="tz-link.html#tzdb">part of many platforms</a>, where the
8101.3Schristosprimary use of this package is to update obsolete time-related files.
8111.3SchristosTo do this, you may need to compile the time zone compiler
8121.3Schristos'<code>zic</code>' supplied with this package instead of using the
8131.3Schristossystem '<code>zic</code>', since the format of <code>zic</code>'s
8141.3Schristosinput is occasionally extended, and a platform may still be shipping
8151.3Schristosan older <code>zic</code>.
8161.1Schristos</p>
8171.1Schristos
8181.3Schristos<h3 id="POSIX">POSIX properties and limitations</h3>
8191.1Schristos<ul>
8201.1Schristos  <li>
8211.1Schristos    <p>
8221.3Schristos    In POSIX, time display in a process is controlled by the
8231.3Schristos    environment variable <code>TZ</code>.
8241.3Schristos    Unfortunately, the POSIX
8251.3Schristos    <code>TZ</code> string takes a form that is hard to describe and
8261.3Schristos    is error-prone in practice.
8271.3Schristos    Also, POSIX <code>TZ</code> strings cannot deal with daylight
8281.3Schristos    saving time rules not based on the Gregorian calendar (as in
8291.3Schristos    Iran), or with situations where more than two time zone
8301.3Schristos    abbreviations or <abbr>UT</abbr> offsets are used in an area.
8311.1Schristos    </p>
8321.3Schristos
8331.1Schristos    <p>
8341.3Schristos    The POSIX <code>TZ</code> string takes the following form:
8351.1Schristos    </p>
8361.3Schristos
8371.1Schristos    <p>
8381.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>]]]
8391.1Schristos    </p>
8401.3Schristos
8411.1Schristos    <p>
8421.3Schristos    where:
8431.3Schristos    </p>
8441.3Schristos
8451.1Schristos    <dl>
8461.1Schristos      <dt><var>std</var> and <var>dst</var></dt><dd>
8471.3Schristos	are 3 or more characters specifying the standard
8481.4Schristos	and daylight saving time (<abbr>DST</abbr>) zone abbreviations.
8491.3Schristos	Starting with POSIX.1-2001, <var>std</var> and <var>dst</var>
8501.3Schristos	may also be in a quoted form like '<code>&lt;+09&gt;</code>';
8511.3Schristos	this allows "<code>+</code>" and "<code>-</code>" in the names.
8521.1Schristos      </dd>
8531.1Schristos      <dt><var>offset</var></dt><dd>
8541.3Schristos	is of the form
8551.3Schristos	'<code>[&plusmn;]<var>hh</var>:[<var>mm</var>[:<var>ss</var>]]</code>'
8561.3Schristos	and specifies the offset west of <abbr>UT</abbr>.
8571.3Schristos	'<var>hh</var>' may be a single digit;
8581.3Schristos	0&le;<var>hh</var>&le;24.
8591.3Schristos	The default <abbr>DST</abbr> offset is one hour ahead of
8601.3Schristos	standard time.
8611.1Schristos      </dd>
8621.1Schristos      <dt><var>date</var>[<code>/</code><var>time</var>]<code>,</code><var>date</var>[<code>/</code><var>time</var>]</dt><dd>
8631.3Schristos	specifies the beginning and end of <abbr>DST</abbr>.
8641.3Schristos	If this is absent, the system supplies its own ruleset
8651.3Schristos	for <abbr>DST</abbr>, and its rules can differ from year to year;
8661.3Schristos	typically <abbr>US</abbr> <abbr>DST</abbr> rules are used.
8671.1Schristos      </dd>
8681.1Schristos      <dt><var>time</var></dt><dd>
8691.3Schristos	takes the form
8701.3Schristos	'<var>hh</var><code>:</code>[<var>mm</var>[<code>:</code><var>ss</var>]]'
8711.3Schristos	and defaults to 02:00.
8721.3Schristos	This is the same format as the offset, except that a
8731.3Schristos	leading '<code>+</code>' or '<code>-</code>' is not allowed.
8741.1Schristos      </dd>
8751.1Schristos      <dt><var>date</var></dt><dd>
8761.3Schristos	takes one of the following forms:
8771.1Schristos	<dl>
8781.1Schristos	  <dt>J<var>n</var> (1&le;<var>n</var>&le;365)</dt><dd>
8791.3Schristos	    origin-1 day number not counting February 29
8801.3Schristos	  </dd>
8811.1Schristos	  <dt><var>n</var> (0&le;<var>n</var>&le;365)</dt><dd>
8821.3Schristos	    origin-0 day number counting February 29 if present
8831.3Schristos	  </dd>
8841.3Schristos	  <dt><code>M</code><var>m</var><code>.</code><var>n</var><code>.</code><var>d</var>
8851.3Schristos	    (0[Sunday]&le;<var>d</var>&le;6[Saturday], 1&le;<var>n</var>&le;5,
8861.3Schristos	    1&le;<var>m</var>&le;12)</dt><dd>
8871.3Schristos	    for the <var>d</var>th day of week <var>n</var> of
8881.3Schristos	    month <var>m</var> of the year, where week 1 is the first
8891.3Schristos	    week in which day <var>d</var> appears, and
8901.3Schristos	    '<code>5</code>' stands for the last week in which
8911.3Schristos	    day <var>d</var> appears (which may be either the 4th or
8921.3Schristos	    5th week).
8931.3Schristos	    Typically, this is the only useful form; the <var>n</var>
8941.3Schristos	    and <code>J</code><var>n</var> forms are rarely used.
8951.1Schristos	  </dd>
8961.3Schristos	</dl>
8971.3Schristos      </dd>
8981.3Schristos    </dl>
8991.3Schristos
9001.3Schristos    <p>
9011.3Schristos    Here is an example POSIX <code>TZ</code> string for New
9021.3Schristos    Zealand after 2007.
9031.3Schristos    It says that standard time (<abbr>NZST</abbr>) is 12 hours ahead
9041.3Schristos    of <abbr>UT</abbr>, and that daylight saving time
9051.3Schristos    (<abbr>NZDT</abbr>) is observed from September's last Sunday at
9061.3Schristos    02:00 until April's first Sunday at 03:00:
9071.3Schristos    </p>
9081.3Schristos
9091.3Schristos    <pre><code>TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'</code></pre>
9101.3Schristos
9111.3Schristos    <p>
9121.3Schristos    This POSIX <code>TZ</code> string is hard to remember, and
9131.3Schristos    mishandles some timestamps before 2008.
9141.3Schristos    With this package you can use this instead:
9151.3Schristos    </p>
9161.3Schristos
9171.3Schristos    <pre><code>TZ='Pacific/Auckland'</code></pre>
9181.3Schristos  </li>
9191.3Schristos  <li>
9201.4Schristos    POSIX does not define the <abbr>DST</abbr> transitions
9211.4Schristos    for <code>TZ</code> values like
9221.3Schristos    "<code>EST5EDT</code>".
9231.4Schristos    Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
9241.4Schristos    were used to interpret such values, but this meant that the
9251.4Schristos    <abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
9261.4Schristos    program that did time conversion. This meant that when
9271.4Schristos    <abbr>US</abbr> time conversion rules changed (as in the United
9281.4Schristos    States in 1987), all programs that did time conversion had to be
9291.3Schristos    recompiled to ensure proper results.
9301.3Schristos  </li>
9311.3Schristos  <li>
9321.3Schristos    The <code>TZ</code> environment variable is process-global, which
9331.3Schristos    makes it hard to write efficient, thread-safe applications that
9341.4Schristos    need access to multiple timezones.
9351.3Schristos  </li>
9361.3Schristos  <li>
9371.3Schristos    In POSIX, there is no tamper-proof way for a process to learn the
9381.3Schristos    system's best idea of local wall clock.
9391.4Schristos    This is important for applications that an administrator wants
9401.3Schristos    used only at certain times &ndash; without regard to whether the
9411.3Schristos    user has fiddled the
9421.3Schristos    <code>TZ</code> environment variable.
9431.3Schristos    While an administrator can "do everything in <abbr>UT</abbr>" to
9441.3Schristos    get around the problem, doing so is inconvenient and precludes
9451.4Schristos    handling daylight saving time shifts &ndash; as might be required to
9461.4Schristos    limit phone calls to off-peak hours.
9471.3Schristos  </li>
9481.3Schristos  <li>
9491.3Schristos    POSIX provides no convenient and efficient way to determine
9501.3Schristos    the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
9511.4Schristos    timestamps, particularly for timezones
9521.3Schristos    that do not fit into the POSIX model.
9531.3Schristos  </li>
9541.3Schristos  <li>
9551.3Schristos    POSIX requires that systems ignore leap seconds.
9561.3Schristos  </li>
9571.3Schristos  <li>
9581.3Schristos    The <code><abbr>tz</abbr></code> code attempts to support all the
9591.3Schristos    <code>time_t</code> implementations allowed by POSIX.
9601.3Schristos    The <code>time_t</code> type represents a nonnegative count of seconds
9611.3Schristos    since 1970-01-01 00:00:00 <abbr>UTC</abbr>, ignoring leap seconds.
9621.3Schristos    In practice, <code>time_t</code> is usually a signed 64- or 32-bit
9631.3Schristos    integer; 32-bit signed <code>time_t</code> values stop working after
9641.3Schristos    2038-01-19 03:14:07 <abbr>UTC</abbr>, so new implementations these
9651.3Schristos    days typically use a signed 64-bit integer.
9661.3Schristos    Unsigned 32-bit integers are used on one or two platforms, and 36-bit
9671.3Schristos    and 40-bit integers are also used occasionally.
9681.3Schristos    Although earlier POSIX versions allowed <code>time_t</code> to be a
9691.4Schristos    floating-point type, this was not supported by any practical system,
9701.3Schristos    and POSIX.1-2013 and the <code><abbr>tz</abbr></code> code both
9711.3Schristos    require <code>time_t</code> to be an integer type.
9721.1Schristos  </li>
9731.1Schristos</ul>
9741.3Schristos
9751.3Schristos<h3 id="POSIX-extensions">Extensions to POSIX in the
9761.3Schristos<code><abbr>tz</abbr></code> code</h3>
9771.1Schristos<ul>
9781.1Schristos  <li>
9791.1Schristos    <p>
9801.3Schristos    The <code>TZ</code> environment variable is used in generating
9811.4Schristos    the name of a file from which time-related information is read
9821.3Schristos    (or is interpreted à la POSIX); <code>TZ</code> is no longer
9831.4Schristos    constrained to be a string containing abbreviations
9841.4Schristos    and numeric data as described <a href="#POSIX">above</a>.
9851.4Schristos    The file's format is <dfn><abbr>TZif</abbr></dfn>,
9861.4Schristos    a timezone information format that contains binary data.
9871.3Schristos    The daylight saving time rules to be used for a
9881.4Schristos    particular timezone are encoded in the
9891.4Schristos    <abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
9901.4Schristos    Australian, and other rules to be encoded, and
9911.3Schristos    allows for situations where more than two time zone
9921.3Schristos    abbreviations are used.
9931.1Schristos    </p>
9941.1Schristos    <p>
9951.3Schristos    It was recognized that allowing the <code>TZ</code> environment
9961.3Schristos    variable to take on values such as '<code>America/New_York</code>'
9971.3Schristos    might cause "old" programs (that expect <code>TZ</code> to have a
9981.3Schristos    certain form) to operate incorrectly; consideration was given to using
9991.3Schristos    some other environment variable (for example, <code>TIMEZONE</code>)
10001.4Schristos    to hold the string used to generate the <abbr>TZif</abbr> file's name.
10011.3Schristos    In the end, however, it was decided to continue using
10021.3Schristos    <code>TZ</code>: it is widely used for time zone purposes;
10031.3Schristos    separately maintaining both <code>TZ</code>
10041.3Schristos    and <code>TIMEZONE</code> seemed a nuisance; and systems where
10051.3Schristos    "new" forms of <code>TZ</code> might cause problems can simply
10061.4Schristos    use legacy <code>TZ</code> values such as "<code>EST5EDT</code>" which
10071.4Schristos    can be used by "new" programs as well as by "old" programs that
10081.4Schristos    assume pre-POSIX <code>TZ</code> values.
10091.1Schristos    </p>
10101.3Schristos  </li>
10111.3Schristos  <li>
10121.3Schristos    The code supports platforms with a <abbr>UT</abbr> offset member
10131.3Schristos    in <code>struct tm</code>, e.g., <code>tm_gmtoff</code>.
10141.3Schristos  </li>
10151.3Schristos  <li>
10161.3Schristos    The code supports platforms with a time zone abbreviation member in
10171.3Schristos    <code>struct tm</code>, e.g., <code>tm_zone</code>.
10181.3Schristos  </li>
10191.3Schristos  <li>
10201.3Schristos    Functions <code>tzalloc</code>, <code>tzfree</code>,
10211.3Schristos    <code>localtime_rz</code>, and <code>mktime_z</code> for
10221.3Schristos    more-efficient thread-safe applications that need to use multiple
10231.4Schristos    timezones.
10241.3Schristos    The <code>tzalloc</code> and <code>tzfree</code> functions
10251.3Schristos    allocate and free objects of type <code>timezone_t</code>,
10261.3Schristos    and <code>localtime_rz</code> and <code>mktime_z</code> are
10271.3Schristos    like <code>localtime_r</code> and <code>mktime</code> with an
10281.3Schristos    extra <code>timezone_t</code> argument.
10291.3Schristos    The functions were inspired by <a href="https://netbsd.org/">NetBSD</a>.
10301.3Schristos  </li>
10311.3Schristos  <li>
10321.3Schristos    A function <code>tzsetwall</code> has been added to arrange for the
10331.3Schristos    system's best approximation to local wall clock time to be delivered
10341.3Schristos    by subsequent calls to <code>localtime</code>.
10351.3Schristos    Source code for portable applications that "must" run on local wall
10361.3Schristos    clock time should call <code>tzsetwall</code>;
10371.3Schristos    if such code is moved to "old" systems that do not
10381.3Schristos    provide <code>tzsetwall</code>, you will not be able to generate an
10391.3Schristos    executable program.
10401.3Schristos    (These functions also arrange for local wall clock time to
10411.3Schristos    be used if <code>tzset</code> is called &ndash; directly or
10421.3Schristos    indirectly &ndash; and there is no <code>TZ</code> environment
10431.3Schristos    variable; portable applications should not, however, rely on this
10441.3Schristos    behavior since it is not the way <a
10451.3Schristos    href="https://en.wikipedia.org/wiki/UNIX_System_V#SVR2"><abbr>SVR2</abbr></a>
10461.3Schristos    systems behave.)
10471.3Schristos  </li>
10481.3Schristos  <li>
10491.3Schristos    Negative <code>time_t</code> values are supported, on systems
10501.3Schristos    where <code>time_t</code> is signed.
10511.3Schristos  </li>
10521.3Schristos  <li>
10531.3Schristos    These functions can account for leap seconds, thanks to Bradley White.
10541.3Schristos  </li>
10551.1Schristos</ul>
10561.3Schristos
10571.3Schristos<h3 id="vestigial">POSIX features no longer needed</h3>
10581.1Schristos<p>
10591.3SchristosPOSIX and <a href="https://en.wikipedia.org/wiki/ISO_C"><abbr>ISO</abbr> C</a>
10601.3Schristosdefine some <a href="https://en.wikipedia.org/wiki/API"><abbr
10611.3Schristostitle="application programming interface">API</abbr>s</a> that are vestigial:
10621.3Schristosthey are not needed, and are relics of a too-simple model that does
10631.3Schristosnot suffice to handle many real-world timestamps.
10641.3SchristosAlthough the <code><abbr>tz</abbr></code> code supports these
10651.3Schristosvestigial <abbr>API</abbr>s for backwards compatibility, they should
10661.3Schristosbe avoided in portable applications.
10671.3SchristosThe vestigial <abbr>API</abbr>s are:
10681.1Schristos</p>
10691.1Schristos<ul>
10701.1Schristos  <li>
10711.3Schristos    The POSIX <code>tzname</code> variable does not suffice and is no
10721.3Schristos    longer needed.
10731.3Schristos    To get a timestamp's time zone abbreviation, consult
10741.3Schristos    the <code>tm_zone</code> member if available; otherwise,
10751.3Schristos    use <code>strftime</code>'s <code>"%Z"</code> conversion
10761.3Schristos    specification.
10771.3Schristos  </li>
10781.3Schristos  <li>
10791.3Schristos    The POSIX <code>daylight</code> and <code>timezone</code>
10801.3Schristos    variables do not suffice and are no longer needed.
10811.3Schristos    To get a timestamp's <abbr>UT</abbr> offset, consult
10821.3Schristos    the <code>tm_gmtoff</code> member if available; otherwise,
10831.3Schristos    subtract values returned by <code>localtime</code>
10841.3Schristos    and <code>gmtime</code> using the rules of the Gregorian calendar,
10851.3Schristos    or use <code>strftime</code>'s <code>"%z"</code> conversion
10861.3Schristos    specification if a string like <code>"+0900"</code> suffices.
10871.3Schristos  </li>
10881.3Schristos  <li>
10891.3Schristos    The <code>tm_isdst</code> member is almost never needed and most of
10901.3Schristos    its uses should be discouraged in favor of the abovementioned
10911.3Schristos    <abbr>API</abbr>s.
10921.3Schristos    Although it can still be used in arguments to
10931.3Schristos    <code>mktime</code> to disambiguate timestamps near
10941.3Schristos    a <abbr>DST</abbr> transition when the clock jumps back, this
10951.3Schristos    disambiguation does not work when standard time itself jumps back,
10961.3Schristos    which can occur when a location changes to a time zone with a
10971.3Schristos    lesser <abbr>UT</abbr> offset.
10981.3Schristos  </li>
10991.3Schristos</ul>
11001.3Schristos
11011.3Schristos<h3 id="other-portability">Other portability notes</h3>
11021.3Schristos<ul>
11031.3Schristos  <li>
11041.3Schristos    The <a href="https://en.wikipedia.org/wiki/Version_7_Unix">7th Edition
11051.3Schristos    UNIX</a> <code>timezone</code> function is not present in this
11061.3Schristos    package; it is impossible to reliably map <code>timezone</code>'s
11071.3Schristos    arguments (a "minutes west of <abbr>GMT</abbr>" value and a
11081.3Schristos    "daylight saving time in effect" flag) to a time zone
11091.3Schristos    abbreviation, and we refuse to guess.
11101.3Schristos    Programs that in the past used the <code>timezone</code> function
11111.3Schristos    may now examine <code>localtime(&amp;clock)-&gt;tm_zone</code>
11121.3Schristos    (if <code>TM_ZONE</code> is defined) or
11131.3Schristos    <code>tzname[localtime(&amp;clock)-&gt;tm_isdst]</code>
11141.3Schristos    (if <code>HAVE_TZNAME</code> is defined) to learn the correct time
11151.3Schristos    zone abbreviation to use.
11161.3Schristos  </li>
11171.3Schristos  <li>
11181.3Schristos    The <a
11191.3Schristos    href="https://en.wikipedia.org/wiki/History_of_the_Berkeley_Software_Distribution#4.2BSD"><abbr>4.2BSD</abbr></a>
11201.3Schristos    <code>gettimeofday</code> function is not
11211.3Schristos    used in this package.
11221.3Schristos    This formerly let users obtain the current <abbr>UTC</abbr> offset
11231.3Schristos    and <abbr>DST</abbr> flag, but this functionality was removed in
11241.3Schristos    later versions of <abbr>BSD</abbr>.
11251.3Schristos  </li>
11261.3Schristos  <li>
11271.3Schristos    In <abbr>SVR2</abbr>, time conversion fails for near-minimum or
11281.3Schristos    near-maximum <code>time_t</code> values when doing conversions
11291.3Schristos    for places that do not use <abbr>UT</abbr>.
11301.3Schristos    This package takes care to do these conversions correctly.
11311.3Schristos    A comment in the source code tells how to get compatibly wrong
11321.3Schristos    results.
11331.3Schristos  </li>
11341.3Schristos  <li>
11351.3Schristos    The functions that are conditionally compiled
11361.3Schristos    if <code>STD_INSPIRED</code> is defined should, at this point, be
11371.3Schristos    looked on primarily as food for thought.
11381.3Schristos    They are not in any sense "standard compatible" &ndash; some are
11391.3Schristos    not, in fact, specified in <em>any</em> standard.
11401.3Schristos    They do, however, represent responses of various authors to
11411.3Schristos    standardization proposals.
11421.3Schristos  </li>
11431.3Schristos  <li>
11441.4Schristos    Other time conversion proposals, in particular those supported by the
11451.4Schristos    <a href="https://howardhinnant.github.io/date/tz.html">Time Zone
11461.4Schristos    Database Parser</a>, offer a wider selection of functions
11471.3Schristos    that provide capabilities beyond those provided here.
11481.3Schristos    The absence of such functions from this package is not meant to
11491.3Schristos    discourage the development, standardization, or use of such
11501.3Schristos    functions.
11511.3Schristos    Rather, their absence reflects the decision to make this package
11521.3Schristos    contain valid extensions to POSIX, to ensure its broad
11531.3Schristos    acceptability.
11541.3Schristos    If more powerful time conversion functions can be standardized, so
11551.3Schristos    much the better.
11561.1Schristos  </li>
11571.1Schristos</ul>
11581.3Schristos</section>
11591.1Schristos
11601.3Schristos<section>
11611.3Schristos  <h2 id="stability">Interface stability</h2>
11621.1Schristos<p>
11631.3SchristosThe <code><abbr>tz</abbr></code> code and data supply the following interfaces:
11641.1Schristos</p>
11651.1Schristos
11661.1Schristos<ul>
11671.1Schristos  <li>
11681.4Schristos    A set of timezone names as per
11691.4Schristos      "<a href="#naming">Names of timezones</a>" above.
11701.1Schristos  </li>
11711.1Schristos  <li>
11721.3Schristos    Library functions described in "<a href="#functions">Time and date
11731.3Schristos      functions</a>" above.
11741.1Schristos  </li>
11751.1Schristos  <li>
11761.3Schristos    The programs <code>tzselect</code>, <code>zdump</code>,
11771.3Schristos    and <code>zic</code>, documented in their man pages.
11781.1Schristos  </li>
11791.1Schristos  <li>
11801.3Schristos    The format of <code>zic</code> input files, documented in
11811.3Schristos    the <code>zic</code> man page.
11821.1Schristos  </li>
11831.1Schristos  <li>
11841.3Schristos    The format of <code>zic</code> output files, documented in
11851.3Schristos    the <code>tzfile</code> man page.
11861.1Schristos  </li>
11871.1Schristos  <li>
11881.3Schristos    The format of zone table files, documented in <code>zone1970.tab</code>.
11891.1Schristos  </li>
11901.1Schristos  <li>
11911.3Schristos    The format of the country code file, documented in <code>iso3166.tab</code>.
11921.1Schristos  </li>
11931.1Schristos  <li>
11941.3Schristos    The version number of the code and data, as the first line of
11951.3Schristos    the text file '<code>version</code>' in each release.
11961.1Schristos  </li>
11971.1Schristos</ul>
11981.3Schristos
11991.1Schristos<p>
12001.1SchristosInterface changes in a release attempt to preserve compatibility with
12011.3Schristosrecent releases.
12021.3SchristosFor example, <code><abbr>tz</abbr></code> data files typically do not
12031.3Schristosrely on recently-added <code>zic</code> features, so that users can
12041.3Schristosrun older <code>zic</code> versions to process newer data files.
12051.3Schristos<a href="tz-link.html#download">Downloading
12061.3Schristosthe <code><abbr>tz</abbr></code> database</a> describes how releases
12071.3Schristosare tagged and distributed.
12081.1Schristos</p>
12091.1Schristos
12101.1Schristos<p>
12111.3SchristosInterfaces not listed above are less stable.
12121.3SchristosFor example, users should not rely on particular <abbr>UT</abbr>
12131.3Schristosoffsets or abbreviations for timestamps, as data entries are often
12141.3Schristosbased on guesswork and these guesses may be corrected or improved.
12151.1Schristos</p>
12161.3Schristos</section>
12171.1Schristos
12181.3Schristos<section>
12191.3Schristos  <h2 id="calendar">Calendrical issues</h2>
12201.1Schristos<p>
12211.1SchristosCalendrical issues are a bit out of scope for a time zone database,
12221.1Schristosbut they indicate the sort of problems that we would run into if we
12231.3Schristosextended the time zone database further into the past.
12241.3SchristosAn excellent resource in this area is Edward M. Reingold
12251.3Schristosand Nachum Dershowitz, <cite><a
12261.3Schristoshref="https://www.cambridge.org/fr/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition">Calendrical
12271.3SchristosCalculations: The Ultimate Edition</a></cite>, Cambridge University Press (2018).
12281.3SchristosOther information and sources are given in the file '<code>calendars</code>'
12291.3Schristosin the <code><abbr>tz</abbr></code> distribution.
12301.3SchristosThey sometimes disagree.
12311.3Schristos</p>
12321.3Schristos</section>
12331.3Schristos
12341.3Schristos<section>
12351.3Schristos  <h2 id="planets">Time and time zones on other planets</h2>
12361.3Schristos<p>
12371.3SchristosSome people's work schedules
12381.4Schristosuse <a href="https://en.wikipedia.org/wiki/Timekeeping_on_Mars">Mars time</a>.
12391.3SchristosJet Propulsion Laboratory (JPL) coordinators kept Mars time on
12401.3Schristosand off during the
12411.3Schristos<a href="https://en.wikipedia.org/wiki/Mars_Pathfinder#End_of_mission">Mars
12421.3SchristosPathfinder</a> mission.
12431.3SchristosSome of their family members also adapted to Mars time.
12441.3SchristosDozens of special Mars watches were built for JPL workers who kept
12451.3SchristosMars time during the Mars Exploration Rovers mission (2004).
12461.3SchristosThese timepieces look like normal Seikos and Citizens but use Mars
12471.3Schristosseconds rather than terrestrial seconds.
12481.1Schristos</p>
12491.1Schristos
12501.1Schristos<p>
12511.1SchristosA Mars solar day is called a "sol" and has a mean period equal to
12521.3Schristosabout 24 hours 39 minutes 35.244 seconds in terrestrial time.
12531.3SchristosIt is divided into a conventional 24-hour clock, so each Mars second
12541.3Schristosequals about 1.02749125 terrestrial seconds.
12551.1Schristos</p>
12561.1Schristos
12571.1Schristos<p>
12581.3SchristosThe <a href="https://en.wikipedia.org/wiki/Prime_meridian">prime
12591.3Schristosmeridian</a> of Mars goes through the center of the crater
12601.3Schristos<a href="https://en.wikipedia.org/wiki/Airy-0">Airy-0</a>, named in
12611.3Schristoshonor of the British astronomer who built the Greenwich telescope that
12621.3Schristosdefines Earth's prime meridian.
12631.3SchristosMean solar time on the Mars prime meridian is
12641.3Schristoscalled <a href="https://en.wikipedia.org/wiki/Mars_Coordinated_Time">Mars
12651.3SchristosCoordinated Time (<abbr>MTC</abbr>)</a>.
12661.1Schristos</p>
12671.1Schristos
12681.1Schristos<p>
12691.1SchristosEach landed mission on Mars has adopted a different reference for
12701.4Schristossolar timekeeping, so there is no real standard for Mars time zones.
12711.3SchristosFor example, the
12721.3Schristos<a href="https://en.wikipedia.org/wiki/Mars_Exploration_Rover">Mars
12731.3SchristosExploration Rover</a> project (2004) defined two time zones "Local
12741.3SchristosSolar Time A" and "Local Solar Time B" for its two missions, each zone
12751.3Schristosdesigned so that its time equals local true solar time at
12761.3Schristosapproximately the middle of the nominal mission.
12771.3SchristosSuch a "time zone" is not particularly suited for any application
12781.3Schristosother than the mission itself.
12791.1Schristos</p>
12801.1Schristos
12811.1Schristos<p>
12821.1SchristosMany calendars have been proposed for Mars, but none have achieved
12831.3Schristoswide acceptance.
12841.3SchristosAstronomers often use Mars Sol Date (<abbr>MSD</abbr>) which is a
12851.1Schristossequential count of Mars solar days elapsed since about 1873-12-29
12861.3Schristos12:00 <abbr>GMT</abbr>.
12871.1Schristos</p>
12881.1Schristos
12891.1Schristos<p>
12901.1SchristosIn our solar system, Mars is the planet with time and calendar most
12911.3Schristoslike Earth's.
12921.3SchristosOn other planets, Sun-based time and calendars would work quite
12931.3Schristosdifferently.
12941.3SchristosFor example, although Mercury's
12951.3Schristos<a href="https://en.wikipedia.org/wiki/Rotation_period">sidereal
12961.3Schristosrotation period</a> is 58.646 Earth days, Mercury revolves around the
12971.3SchristosSun so rapidly that an observer on Mercury's equator would see a
12981.3Schristossunrise only every 175.97 Earth days, i.e., a Mercury year is 0.5 of a
12991.3SchristosMercury day.
13001.3SchristosVenus is more complicated, partly because its rotation is slightly
13011.3Schristos<a href="https://en.wikipedia.org/wiki/Retrograde_motion">retrograde</a>:
13021.3Schristosits year is 1.92 of its days.
13031.3SchristosGas giants like Jupiter are trickier still, as their polar and
13041.3Schristosequatorial regions rotate at different rates, so that the length of a
13051.3Schristosday depends on latitude.
13061.3SchristosThis effect is most pronounced on Neptune, where the day is about 12
13071.3Schristoshours at the poles and 18 hours at the equator.
13081.1Schristos</p>
13091.1Schristos
13101.1Schristos<p>
13111.3SchristosAlthough the <code><abbr>tz</abbr></code> database does not support
13121.3Schristostime on other planets, it is documented here in the hopes that support
13131.3Schristoswill be added eventually.
13141.1Schristos</p>
13151.1Schristos
13161.1Schristos<p>
13171.3SchristosSources for time on other planets:
13181.1Schristos</p>
13191.3Schristos
13201.1Schristos<ul>
13211.1Schristos  <li>
13221.3Schristos    Michael Allison and Robert Schmunk,
13231.3Schristos    "<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical
13241.3Schristos      Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>"
13251.3Schristos    (2015-06-30).
13261.1Schristos  </li>
13271.1Schristos  <li>
13281.3Schristos    Jia-Rui Chong,
13291.3Schristos    "<a href="http://articles.latimes.com/2004/jan/14/science/sci-marstime14">Workdays
13301.3Schristos    Fit for a Martian</a>", <cite>Los Angeles Times</cite>
13311.3Schristos    (2004-01-14), pp A1, A20&ndash;A21.
13321.1Schristos  </li>
13331.1Schristos  <li>
13341.3Schristos    Tom Chmielewski,
13351.3Schristos    "<a href="https://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/">Jet
13361.3Schristos    Lag Is Worse on Mars</a>", <cite>The Atlantic</cite> (2015-02-26)
13371.1Schristos  </li>
13381.1Schristos  <li>
13391.3Schristos    Matt Williams,
13401.3Schristos    "<a href="https://www.universetoday.com/37481/days-of-the-planets/">How
13411.3Schristos    long is a day on the other planets of the solar system?</a>"
13421.4Schristos    (2016-01-20).
13431.1Schristos  </li>
13441.1Schristos</ul>
13451.3Schristos</section>
13461.1Schristos
13471.3Schristos<footer>
13481.3Schristos  <hr>
13491.3Schristos  This file is in the public domain, so clarified as of 2009-05-17 by
13501.3Schristos  Arthur David Olson.
13511.3Schristos</footer>
13521.1Schristos</body>
13531.1Schristos</html>
1354