Home | History | Annotate | Line # | Download | only in time
theory.html revision 1.4
      1  1.4  christos <!DOCTYPE html>
      2  1.1  christos <html lang="en">
      3  1.1  christos <head>
      4  1.1  christos   <title>Theory and pragmatics of the tz code and data</title>
      5  1.1  christos   <meta charset="UTF-8">
      6  1.4  christos   <style>
      7  1.4  christos     pre {margin-left: 2em; white-space: pre-wrap;}
      8  1.4  christos   </style>
      9  1.1  christos </head>
     10  1.1  christos 
     11  1.1  christos <body>
     12  1.3  christos <h1>Theory and pragmatics of the <code><abbr>tz</abbr></code> code and data</h1>
     13  1.1  christos   <h3>Outline</h3>
     14  1.1  christos   <nav>
     15  1.1  christos     <ul>
     16  1.3  christos       <li><a href="#scope">Scope of the <code><abbr>tz</abbr></code>
     17  1.3  christos 	  database</a></li>
     18  1.4  christos       <li><a href="#naming">Names of timezones</a></li>
     19  1.1  christos       <li><a href="#abbreviations">Time zone abbreviations</a></li>
     20  1.3  christos       <li><a href="#accuracy">Accuracy of the <code><abbr>tz</abbr></code>
     21  1.3  christos 	  database</a></li>
     22  1.1  christos       <li><a href="#functions">Time and date functions</a></li>
     23  1.1  christos       <li><a href="#stability">Interface stability</a></li>
     24  1.1  christos       <li><a href="#calendar">Calendrical issues</a></li>
     25  1.1  christos       <li><a href="#planets">Time and time zones on other planets</a></li>
     26  1.1  christos     </ul>
     27  1.1  christos   </nav>
     28  1.1  christos 
     29  1.3  christos <section>
     30  1.3  christos   <h2 id="scope">Scope of the <code><abbr>tz</abbr></code> database</h2>
     31  1.1  christos <p>
     32  1.3  christos The <a
     33  1.3  christos href="https://www.iana.org/time-zones"><code><abbr>tz</abbr></code>
     34  1.3  christos database</a> attempts to record the history and predicted future of
     35  1.3  christos all computer-based clocks that track civil time.
     36  1.3  christos It organizes <a href="tz-link.html">time zone and daylight saving time
     37  1.3  christos data</a> by partitioning the world into <a
     38  1.4  christos href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><dfn>timezones</dfn></a>
     39  1.3  christos whose clocks all agree about timestamps that occur after the <a
     40  1.3  christos href="https://en.wikipedia.org/wiki/Unix_time">POSIX Epoch</a>
     41  1.3  christos (1970-01-01 00:00:00 <a
     42  1.3  christos href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr
     43  1.3  christos title="Coordinated Universal Time">UTC</abbr></a>).
     44  1.4  christos The database labels each timezone with a notable location and
     45  1.3  christos records all known clock transitions for that location.
     46  1.3  christos Although 1970 is a somewhat-arbitrary cutoff, there are significant
     47  1.3  christos challenges to moving the cutoff earlier even by a decade or two, due
     48  1.3  christos to the wide variety of local practices before computer timekeeping
     49  1.3  christos became prevalent.
     50  1.1  christos </p>
     51  1.1  christos 
     52  1.1  christos <p>
     53  1.4  christos Each timezone typically corresponds to a geographical region that is
     54  1.4  christos smaller than a traditional time zone, because clocks in a timezone
     55  1.4  christos all agree after 1970 whereas a traditional time zone merely
     56  1.4  christos specifies current standard time. For example, applications that deal
     57  1.4  christos with current and future timestamps in the traditional North
     58  1.4  christos American mountain time zone can choose from the timezones
     59  1.4  christos <code>America/Denver</code> which observes US-style daylight saving
     60  1.4  christos time, <code>America/Mazatlan</code> which observes Mexican-style DST,
     61  1.4  christos and <code>America/Phoenix</code> which does not observe DST.
     62  1.4  christos Applications that also deal with past timestamps in the mountain time
     63  1.4  christos zone can choose from over a dozen timezones, such as
     64  1.4  christos <code>America/Boise</code>, <code>America/Edmonton</code>, and
     65  1.4  christos <code>America/Hermosillo</code>, each of which currently uses mountain
     66  1.4  christos time but differs from other timezones for some timestamps after 1970.
     67  1.4  christos </p>
     68  1.4  christos 
     69  1.4  christos <p>
     70  1.4  christos Clock transitions before 1970 are recorded for each timezone,
     71  1.1  christos because most systems support timestamps before 1970 and could
     72  1.1  christos misbehave if data entries were omitted for pre-1970 transitions.
     73  1.1  christos However, the database is not designed for and does not suffice for
     74  1.1  christos applications requiring accurate handling of all past times everywhere,
     75  1.1  christos as it would take far too much effort and guesswork to record all
     76  1.1  christos details of pre-1970 civil timekeeping.
     77  1.3  christos Although some information outside the scope of the database is
     78  1.2  christos collected in a file <code>backzone</code> that is distributed along
     79  1.2  christos with the database proper, this file is less reliable and does not
     80  1.2  christos necessarily follow database guidelines.
     81  1.1  christos </p>
     82  1.1  christos 
     83  1.1  christos <p>
     84  1.3  christos As described below, reference source code for using the
     85  1.3  christos <code><abbr>tz</abbr></code> database is also available.
     86  1.3  christos The <code><abbr>tz</abbr></code> code is upwards compatible with <a
     87  1.3  christos href="https://en.wikipedia.org/wiki/POSIX">POSIX</a>, an international
     88  1.3  christos standard for <a
     89  1.3  christos href="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems.
     90  1.3  christos As of this writing, the current edition of POSIX is: <a
     91  1.3  christos href="http://pubs.opengroup.org/onlinepubs/9699919799/"> The Open
     92  1.3  christos Group Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018
     93  1.3  christos Edition.
     94  1.3  christos Because the database's scope encompasses real-world changes to civil
     95  1.3  christos timekeeping, its model for describing time is more complex than the
     96  1.3  christos standard and daylight saving times supported by POSIX.
     97  1.4  christos A <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can
     98  1.3  christos have more than two changes per year, these changes need not merely
     99  1.3  christos flip back and forth between two alternatives, and the rules themselves
    100  1.3  christos can change at times.
    101  1.4  christos Whether and when a timezone changes its
    102  1.4  christos clock, and even the timezone's notional base offset from UTC, are variable.
    103  1.4  christos It does not always make sense to talk about a timezone's
    104  1.4  christos "base offset", which is not necessarily a single number.
    105  1.1  christos </p>
    106  1.1  christos 
    107  1.3  christos </section>
    108  1.1  christos 
    109  1.3  christos <section>
    110  1.4  christos   <h2 id="naming">Names of timezones</h2>
    111  1.1  christos <p>
    112  1.4  christos Each timezone has a unique name.
    113  1.1  christos Inexperienced users are not expected to select these names unaided.
    114  1.1  christos Distributors should provide documentation and/or a simple selection
    115  1.4  christos interface that explains each name via a map or via descriptive text like
    116  1.4  christos "Ruthenia" instead of the timezone name "<code>Europe/Uzhgorod</code>".
    117  1.4  christos If geolocation information is available, a selection interface can
    118  1.4  christos locate the user on a timezone map or prioritize names that are
    119  1.4  christos geographically close. For an example selection interface, see the
    120  1.3  christos <code>tzselect</code> program in the <code><abbr>tz</abbr></code> code.
    121  1.3  christos The <a href="http://cldr.unicode.org/">Unicode Common Locale Data
    122  1.3  christos Repository</a> contains data that may be useful for other selection
    123  1.4  christos interfaces; it maps timezone names like <code>Europe/Uzhgorod</code>
    124  1.4  christos to CLDR names like <code>uauzh</code> which are in turn mapped to
    125  1.4  christos locale-dependent strings like "Uzhhorod", "Ungvr", "", and
    126  1.4  christos "".
    127  1.1  christos </p>
    128  1.1  christos 
    129  1.1  christos <p>
    130  1.3  christos The naming conventions attempt to strike a balance
    131  1.1  christos among the following goals:
    132  1.1  christos </p>
    133  1.3  christos 
    134  1.1  christos <ul>
    135  1.1  christos   <li>
    136  1.4  christos     Uniquely identify every timezone where clocks have agreed since 1970.
    137  1.3  christos     This is essential for the intended use: static clocks keeping local
    138  1.3  christos     civil time.
    139  1.1  christos   </li>
    140  1.1  christos   <li>
    141  1.4  christos     Indicate to experts where the timezone's clocks typically are.
    142  1.1  christos   </li>
    143  1.1  christos   <li>
    144  1.3  christos     Be robust in the presence of political changes.
    145  1.3  christos     For example, names of countries are ordinarily not used, to avoid
    146  1.3  christos     incompatibilities when countries change their name (e.g.,
    147  1.3  christos     Zaire&rarr;Congo) or when locations change countries (e.g., Hong
    148  1.3  christos     Kong from UK colony to China).
    149  1.1  christos   </li>
    150  1.1  christos   <li>
    151  1.3  christos     Be portable to a wide variety of implementations.
    152  1.1  christos   </li>
    153  1.1  christos   <li>
    154  1.3  christos     Use a consistent naming conventions over the entire world.
    155  1.1  christos   </li>
    156  1.1  christos </ul>
    157  1.3  christos 
    158  1.1  christos <p>
    159  1.3  christos Names normally have the form
    160  1.3  christos <var>AREA</var><code>/</code><var>LOCATION</var>, where
    161  1.4  christos <var>AREA</var> is a continent or ocean, and
    162  1.4  christos <var>LOCATION</var> is a specific location within the area.
    163  1.3  christos North and South America share the same area, '<code>America</code>'.
    164  1.3  christos Typical names are '<code>Africa/Cairo</code>',
    165  1.3  christos '<code>America/New_York</code>', and '<code>Pacific/Honolulu</code>'.
    166  1.3  christos Some names are further qualified to help avoid confusion; for example,
    167  1.3  christos '<code>America/Indiana/Petersburg</code>' distinguishes Petersburg,
    168  1.3  christos Indiana from other Petersburgs in America.
    169  1.1  christos </p>
    170  1.1  christos 
    171  1.1  christos <p>
    172  1.3  christos Here are the general guidelines used for
    173  1.4  christos choosing timezone names,
    174  1.1  christos in decreasing order of importance:
    175  1.1  christos </p>
    176  1.3  christos 
    177  1.1  christos <ul>
    178  1.1  christos   <li>
    179  1.3  christos     Use only valid POSIX file name components (i.e., the parts of
    180  1.3  christos     names other than '<code>/</code>').
    181  1.3  christos     Do not use the file name components '<code>.</code>' and
    182  1.3  christos     '<code>..</code>'.
    183  1.3  christos     Within a file name component, use only <a
    184  1.3  christos     href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters,
    185  1.3  christos     '<code>.</code>', '<code>-</code>' and '<code>_</code>'.
    186  1.3  christos     Do not use digits, as that might create an ambiguity with <a
    187  1.3  christos     href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX
    188  1.3  christos     <code>TZ</code> strings</a>.
    189  1.3  christos     A file name component must not exceed 14 characters or start with
    190  1.3  christos     '<code>-</code>'.
    191  1.3  christos     E.g., prefer <code>Asia/Brunei</code> to
    192  1.3  christos     <code>Asia/Bandar_Seri_Begawan</code>.
    193  1.3  christos     Exceptions: see the discussion of legacy names below.
    194  1.1  christos   </li>
    195  1.1  christos   <li>
    196  1.3  christos     A name must not be empty, or contain '<code>//</code>', or
    197  1.3  christos     start or end with '<code>/</code>'.
    198  1.1  christos   </li>
    199  1.1  christos   <li>
    200  1.3  christos     Do not use names that differ only in case.
    201  1.3  christos     Although the reference implementation is case-sensitive, some
    202  1.3  christos     other implementations are not, and they would mishandle names
    203  1.3  christos     differing only in case.
    204  1.1  christos   </li>
    205  1.1  christos   <li>
    206  1.3  christos     If one name <var>A</var> is an initial prefix of another
    207  1.3  christos     name <var>AB</var> (ignoring case), then <var>B</var> must not
    208  1.3  christos     start with '<code>/</code>', as a regular file cannot have the
    209  1.3  christos     same name as a directory in POSIX.
    210  1.3  christos     For example, <code>America/New_York</code> precludes
    211  1.3  christos     <code>America/New_York/Bronx</code>.
    212  1.1  christos   </li>
    213  1.1  christos   <li>
    214  1.3  christos     Uninhabited regions like the North Pole and Bouvet Island
    215  1.3  christos     do not need locations, since local time is not defined there.
    216  1.1  christos   </li>
    217  1.1  christos   <li>
    218  1.3  christos     There should typically be at least one name for each <a
    219  1.3  christos     href="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr
    220  1.3  christos     title="International Organization for Standardization">ISO</abbr>
    221  1.3  christos     3166-1</a> officially assigned two-letter code for an inhabited
    222  1.3  christos     country or territory.
    223  1.1  christos   </li>
    224  1.1  christos   <li>
    225  1.4  christos     If all the clocks in a timezone have agreed since 1970,
    226  1.4  christos     do not bother to include more than one timezone
    227  1.4  christos     even if some of the clocks disagreed before 1970.
    228  1.3  christos     Otherwise these tables would become annoyingly large.
    229  1.1  christos   </li>
    230  1.1  christos   <li>
    231  1.3  christos     If a name is ambiguous, use a less ambiguous alternative;
    232  1.3  christos     e.g., many cities are named San Jos and Georgetown, so
    233  1.3  christos     prefer <code>America/Costa_Rica</code> to
    234  1.3  christos     <code>America/San_Jose</code> and <code>America/Guyana</code>
    235  1.3  christos     to <code>America/Georgetown</code>.
    236  1.1  christos   </li>
    237  1.1  christos   <li>
    238  1.3  christos     Keep locations compact.
    239  1.3  christos     Use cities or small islands, not countries or regions, so that any
    240  1.3  christos     future changes do not split individual locations into different
    241  1.4  christos     timezones.
    242  1.3  christos     E.g., prefer <code>Europe/Paris</code> to <code>Europe/France</code>,
    243  1.3  christos     since
    244  1.3  christos     <a href="https://en.wikipedia.org/wiki/Time_in_France#History">France
    245  1.3  christos     has had multiple time zones</a>.
    246  1.1  christos   </li>
    247  1.1  christos   <li>
    248  1.3  christos     Use mainstream English spelling, e.g., prefer
    249  1.4  christos     <code>Europe/Rome</code> to <code>Europa/Roma</code>, and
    250  1.3  christos     prefer <code>Europe/Athens</code> to the Greek
    251  1.4  christos     <code>/</code> or the Romanized
    252  1.4  christos     <code>Evrpi/Athna</code>.
    253  1.3  christos     The POSIX file name restrictions encourage this guideline.
    254  1.1  christos   </li>
    255  1.1  christos   <li>
    256  1.3  christos     Use the most populous among locations in a region,
    257  1.3  christos     e.g., prefer <code>Asia/Shanghai</code> to
    258  1.3  christos     <code>Asia/Beijing</code>.
    259  1.3  christos     Among locations with similar populations, pick the best-known
    260  1.3  christos     location, e.g., prefer <code>Europe/Rome</code> to
    261  1.3  christos     <code>Europe/Milan</code>.
    262  1.1  christos   </li>
    263  1.1  christos   <li>
    264  1.3  christos     Use the singular form, e.g., prefer <code>Atlantic/Canary</code> to
    265  1.3  christos     <code>Atlantic/Canaries</code>.
    266  1.1  christos   </li>
    267  1.1  christos   <li>
    268  1.3  christos     Omit common suffixes like '<code>_Islands</code>' and
    269  1.3  christos     '<code>_City</code>', unless that would lead to ambiguity.
    270  1.3  christos     E.g., prefer <code>America/Cayman</code> to
    271  1.3  christos     <code>America/Cayman_Islands</code> and
    272  1.3  christos     <code>America/Guatemala</code> to
    273  1.3  christos     <code>America/Guatemala_City</code>, but prefer
    274  1.3  christos     <code>America/Mexico_City</code> to
    275  1.3  christos     <code>America/Mexico</code>
    276  1.3  christos     because <a href="https://en.wikipedia.org/wiki/Time_in_Mexico">the
    277  1.3  christos     country of Mexico has several time zones</a>.
    278  1.1  christos   </li>
    279  1.1  christos   <li>
    280  1.3  christos     Use '<code>_</code>' to represent a space.
    281  1.1  christos   </li>
    282  1.1  christos   <li>
    283  1.3  christos     Omit '<code>.</code>' from abbreviations in names.
    284  1.3  christos     E.g., prefer <code>Atlantic/St_Helena</code> to
    285  1.3  christos     <code>Atlantic/St._Helena</code>.
    286  1.1  christos   </li>
    287  1.1  christos   <li>
    288  1.3  christos     Do not change established names if they only marginally violate
    289  1.3  christos     the above guidelines.
    290  1.3  christos     For example, do not change the existing name <code>Europe/Rome</code> to
    291  1.3  christos     <code>Europe/Milan</code> merely because Milan's population has grown
    292  1.3  christos     to be somewhat greater than Rome's.
    293  1.1  christos   </li>
    294  1.1  christos   <li>
    295  1.3  christos     If a name is changed, put its old spelling in the
    296  1.3  christos     '<code>backward</code>' file.
    297  1.3  christos     This means old spellings will continue to work.
    298  1.1  christos   </li>
    299  1.1  christos </ul>
    300  1.1  christos 
    301  1.1  christos <p>
    302  1.1  christos The file '<code>zone1970.tab</code>' lists geographical locations used
    303  1.4  christos to name timezones.
    304  1.3  christos It is intended to be an exhaustive list of names for geographic
    305  1.4  christos regions as described above; this is a subset of the timezones in the data.
    306  1.3  christos Although a '<code>zone1970.tab</code>' location's
    307  1.3  christos <a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
    308  1.3  christos corresponds to
    309  1.3  christos its <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean
    310  1.3  christos time (<abbr>LMT</abbr>)</a> offset with one hour for every 15&deg;
    311  1.3  christos east longitude, this relationship is not exact.
    312  1.1  christos </p>
    313  1.1  christos 
    314  1.1  christos <p>
    315  1.1  christos Older versions of this package used a different naming scheme,
    316  1.1  christos and these older names are still supported.
    317  1.1  christos See the file '<code>backward</code>' for most of these older names
    318  1.1  christos (e.g., '<code>US/Eastern</code>' instead of '<code>America/New_York</code>').
    319  1.1  christos The other old-fashioned names still supported are
    320  1.3  christos '<code>WET</code>', '<code>CET</code>', '<code>MET</code>', and
    321  1.3  christos '<code>EET</code>' (see the file '<code>europe</code>').
    322  1.1  christos </p>
    323  1.1  christos 
    324  1.1  christos <p>
    325  1.1  christos Older versions of this package defined legacy names that are
    326  1.3  christos incompatible with the first guideline of location names, but which are
    327  1.3  christos still supported.
    328  1.3  christos These legacy names are mostly defined in the file
    329  1.3  christos '<code>etcetera</code>'.
    330  1.3  christos Also, the file '<code>backward</code>' defines the legacy names
    331  1.3  christos '<code>GMT0</code>', '<code>GMT-0</code>' and '<code>GMT+0</code>',
    332  1.3  christos and the file '<code>northamerica</code>' defines the legacy names
    333  1.3  christos '<code>EST5EDT</code>', '<code>CST6CDT</code>',
    334  1.3  christos '<code>MST7MDT</code>', and '<code>PST8PDT</code>'.
    335  1.1  christos </p>
    336  1.1  christos 
    337  1.1  christos <p>
    338  1.3  christos Excluding '<code>backward</code>' should not affect the other data.
    339  1.3  christos If '<code>backward</code>' is excluded, excluding
    340  1.3  christos '<code>etcetera</code>' should not affect the remaining data.
    341  1.1  christos </p>
    342  1.3  christos </section>
    343  1.1  christos 
    344  1.3  christos <section>
    345  1.3  christos   <h2 id="abbreviations">Time zone abbreviations</h2>
    346  1.1  christos <p>
    347  1.1  christos When this package is installed, it generates time zone abbreviations
    348  1.1  christos like '<code>EST</code>' to be compatible with human tradition and POSIX.
    349  1.3  christos Here are the general guidelines used for choosing time zone abbreviations,
    350  1.1  christos in decreasing order of importance:
    351  1.3  christos </p>
    352  1.3  christos 
    353  1.1  christos <ul>
    354  1.1  christos   <li>
    355  1.3  christos     Use three to six characters that are ASCII alphanumerics or
    356  1.3  christos     '<code>+</code>' or '<code>-</code>'.
    357  1.3  christos     Previous editions of this database also used characters like
    358  1.3  christos     space and '<code>?</code>', but these characters have a
    359  1.3  christos     special meaning to the
    360  1.3  christos     <a href="https://en.wikipedia.org/wiki/Unix_shell">UNIX shell</a>
    361  1.3  christos     and cause commands like
    362  1.3  christos     '<code><a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a>
    363  1.3  christos     `<a href="http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>'
    364  1.3  christos     to have unexpected effects.
    365  1.3  christos     Previous editions of this guideline required upper-case letters, but the
    366  1.3  christos     Congressman who introduced
    367  1.3  christos     <a href="https://en.wikipedia.org/wiki/Chamorro_Time_Zone">Chamorro
    368  1.3  christos     Standard Time</a> preferred "ChST", so lower-case letters are now
    369  1.3  christos     allowed.
    370  1.3  christos     Also, POSIX from 2001 on relaxed the rule to allow '<code>-</code>',
    371  1.3  christos     '<code>+</code>', and alphanumeric characters from the portable
    372  1.3  christos     character set in the current locale.
    373  1.3  christos     In practice ASCII alphanumerics and '<code>+</code>' and
    374  1.3  christos     '<code>-</code>' are safe in all locales.
    375  1.3  christos 
    376  1.3  christos     <p>
    377  1.3  christos     In other words, in the C locale the POSIX extended regular
    378  1.3  christos     expression <code>[-+[:alnum:]]{3,6}</code> should match the
    379  1.3  christos     abbreviation.
    380  1.3  christos     This guarantees that all abbreviations could have been specified by a
    381  1.3  christos     POSIX <code>TZ</code> string.
    382  1.3  christos     </p>
    383  1.3  christos   </li>
    384  1.3  christos   <li>
    385  1.3  christos     Use abbreviations that are in common use among English-speakers,
    386  1.3  christos     e.g., 'EST' for Eastern Standard Time in North America.
    387  1.3  christos     We assume that applications translate them to other languages
    388  1.3  christos     as part of the normal localization process; for example,
    389  1.3  christos     a French application might translate 'EST' to 'HNE'.
    390  1.3  christos 
    391  1.3  christos     <p>
    392  1.3  christos     <small>These abbreviations (for standard/daylight/etc. time) are:
    393  1.3  christos       ACST/ACDT Australian Central,
    394  1.3  christos       AST/ADT/APT/AWT/ADDT Atlantic,
    395  1.3  christos       AEST/AEDT Australian Eastern,
    396  1.3  christos       AHST/AHDT Alaska-Hawaii,
    397  1.3  christos       AKST/AKDT Alaska,
    398  1.3  christos       AWST/AWDT Australian Western,
    399  1.3  christos       BST/BDT Bering,
    400  1.3  christos       CAT/CAST Central Africa,
    401  1.3  christos       CET/CEST/CEMT Central European,
    402  1.3  christos       ChST Chamorro,
    403  1.3  christos       CST/CDT/CWT/CPT/CDDT Central [North America],
    404  1.3  christos       CST/CDT China,
    405  1.3  christos       GMT/BST/IST/BDST Greenwich,
    406  1.3  christos       EAT East Africa,
    407  1.3  christos       EST/EDT/EWT/EPT/EDDT Eastern [North America],
    408  1.3  christos       EET/EEST Eastern European,
    409  1.3  christos       GST Guam,
    410  1.3  christos       HST/HDT Hawaii,
    411  1.3  christos       HKT/HKST Hong Kong,
    412  1.3  christos       IST India,
    413  1.3  christos       IST/GMT Irish,
    414  1.3  christos       IST/IDT/IDDT Israel,
    415  1.3  christos       JST/JDT Japan,
    416  1.3  christos       KST/KDT Korea,
    417  1.3  christos       MET/MEST Middle European (a backward-compatibility alias for
    418  1.3  christos 	Central European),
    419  1.3  christos       MSK/MSD Moscow,
    420  1.3  christos       MST/MDT/MWT/MPT/MDDT Mountain,
    421  1.3  christos       NST/NDT/NWT/NPT/NDDT Newfoundland,
    422  1.3  christos       NST/NDT/NWT/NPT Nome,
    423  1.3  christos       NZMT/NZST New Zealand through 1945,
    424  1.3  christos       NZST/NZDT New Zealand 1946&ndash;present,
    425  1.3  christos       PKT/PKST Pakistan,
    426  1.3  christos       PST/PDT/PWT/PPT/PDDT Pacific,
    427  1.4  christos       PST/PDT Philippine,
    428  1.3  christos       SAST South Africa,
    429  1.3  christos       SST Samoa,
    430  1.3  christos       WAT/WAST West Africa,
    431  1.3  christos       WET/WEST/WEMT Western European,
    432  1.3  christos       WIB Waktu Indonesia Barat,
    433  1.3  christos       WIT Waktu Indonesia Timur,
    434  1.3  christos       WITA Waktu Indonesia Tengah,
    435  1.3  christos       YST/YDT/YWT/YPT/YDDT Yukon</small>.
    436  1.3  christos     </p>
    437  1.3  christos   </li>
    438  1.3  christos   <li>
    439  1.3  christos     <p>
    440  1.3  christos     For times taken from a city's longitude, use the
    441  1.3  christos     traditional <var>x</var>MT notation.
    442  1.3  christos     The only abbreviation like this in current use is '<abbr>GMT</abbr>'.
    443  1.3  christos     The others are for timestamps before 1960,
    444  1.3  christos     except that Monrovia Mean Time persisted until 1972.
    445  1.3  christos     Typically, numeric abbreviations (e.g., '<code>-</code>004430' for
    446  1.3  christos     MMT) would cause trouble here, as the numeric strings would exceed
    447  1.3  christos     the POSIX length limit.
    448  1.3  christos     </p>
    449  1.3  christos 
    450  1.3  christos     <p>
    451  1.3  christos     <small>These abbreviations are:
    452  1.3  christos       AMT Amsterdam, Asuncin, Athens;
    453  1.3  christos       BMT Baghdad, Bangkok, Batavia, Bern, Bogot, Bridgetown, Brussels,
    454  1.3  christos 	Bucharest;
    455  1.3  christos       CMT Calamarca, Caracas, Chisinau, Coln, Copenhagen, Crdoba;
    456  1.3  christos       DMT Dublin/Dunsink;
    457  1.3  christos       EMT Easter;
    458  1.3  christos       FFMT Fort-de-France;
    459  1.3  christos       FMT Funchal;
    460  1.3  christos       GMT Greenwich;
    461  1.3  christos       HMT Havana, Helsinki, Horta, Howrah;
    462  1.3  christos       IMT Irkutsk, Istanbul;
    463  1.3  christos       JMT Jerusalem;
    464  1.3  christos       KMT Kaunas, Kiev, Kingston;
    465  1.3  christos       LMT Lima, Lisbon, local, Luanda;
    466  1.3  christos       MMT Macassar, Madras, Mal, Managua, Minsk, Monrovia, Montevideo,
    467  1.3  christos 	Moratuwa, Moscow;
    468  1.3  christos       PLMT Ph Lin;
    469  1.3  christos       PMT Paramaribo, Paris, Perm, Pontianak, Prague;
    470  1.3  christos       PMMT Port Moresby;
    471  1.3  christos       QMT Quito;
    472  1.3  christos       RMT Rangoon, Riga, Rome;
    473  1.3  christos       SDMT Santo Domingo;
    474  1.3  christos       SJMT San Jos;
    475  1.3  christos       SMT Santiago, Simferopol, Singapore, Stanley;
    476  1.3  christos       TBMT Tbilisi;
    477  1.3  christos       TMT Tallinn, Tehran;
    478  1.3  christos       WMT Warsaw</small>.
    479  1.3  christos     </p>
    480  1.3  christos 
    481  1.3  christos     <p>
    482  1.3  christos     <small>A few abbreviations also follow the pattern that
    483  1.4  christos     <abbr>GMT</abbr>/<abbr>BST</abbr> established for time in the UK.
    484  1.3  christos     They are:
    485  1.3  christos       CMT/BST for Calamarca Mean Time and Bolivian Summer Time
    486  1.3  christos 	1890&ndash;1932,
    487  1.3  christos       DMT/IST for Dublin/Dunsink Mean Time and Irish Summer Time
    488  1.3  christos 	1880&ndash;1916,
    489  1.3  christos       MMT/MST/MDST for Moscow 1880&ndash;1919, and
    490  1.3  christos       RMT/LST for Riga Mean Time and Latvian Summer time 1880&ndash;1926.
    491  1.3  christos     An extra-special case is SET for Swedish Time (<em>svensk
    492  1.3  christos     normaltid</em>) 1879&ndash;1899, 3&deg; west of the Stockholm
    493  1.3  christos     Observatory.</small>
    494  1.3  christos     </p>
    495  1.3  christos   </li>
    496  1.3  christos   <li>
    497  1.3  christos     Use '<abbr>LMT</abbr>' for local mean time of locations before the
    498  1.3  christos     introduction of standard time; see "<a href="#scope">Scope of the
    499  1.3  christos     <code><abbr>tz</abbr></code> database</a>".
    500  1.3  christos   </li>
    501  1.3  christos   <li>
    502  1.3  christos     If there is no common English abbreviation, use numeric offsets like
    503  1.4  christos     <code>-</code>05 and <code>+</code>0530 that are generated
    504  1.3  christos     by <code>zic</code>'s <code>%z</code> notation.
    505  1.3  christos   </li>
    506  1.3  christos   <li>
    507  1.3  christos     Use current abbreviations for older timestamps to avoid confusion.
    508  1.3  christos     For example, in 1910 a common English abbreviation for time
    509  1.3  christos     in central Europe was 'MEZ' (short for both "Middle European
    510  1.3  christos     Zone" and for "Mitteleuropische Zeit" in German).
    511  1.3  christos     Nowadays 'CET' ("Central European Time") is more common in
    512  1.3  christos     English, and the database uses 'CET' even for circa-1910
    513  1.3  christos     timestamps as this is less confusing for modern users and avoids
    514  1.3  christos     the need for determining when 'CET' supplanted 'MEZ' in common
    515  1.3  christos     usage.
    516  1.3  christos   </li>
    517  1.3  christos   <li>
    518  1.4  christos     Use a consistent style in a timezone's history.
    519  1.4  christos     For example, if a history tends to use numeric
    520  1.3  christos     abbreviations and a particular entry could go either way, use a
    521  1.3  christos     numeric abbreviation.
    522  1.3  christos   </li>
    523  1.3  christos   <li>
    524  1.3  christos     Use
    525  1.3  christos     <a href="https://en.wikipedia.org/wiki/Universal_Time">Universal Time</a>
    526  1.3  christos     (<abbr>UT</abbr>) (with time zone abbreviation '<code>-</code>00') for
    527  1.3  christos     locations while uninhabited.
    528  1.3  christos     The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in
    529  1.3  christos     some sense undefined; this notation is derived
    530  1.3  christos     from <a href="https://tools.ietf.org/html/rfc3339">Internet
    531  1.4  christos     <abbr title="Request For Comments">RFC</abbr> 3339</a>.
    532  1.1  christos   </li>
    533  1.1  christos </ul>
    534  1.3  christos 
    535  1.1  christos <p>
    536  1.1  christos Application writers should note that these abbreviations are ambiguous
    537  1.2  christos in practice: e.g., 'CST' means one thing in China and something else
    538  1.2  christos in North America, and 'IST' can refer to time in India, Ireland or
    539  1.3  christos Israel.
    540  1.3  christos To avoid ambiguity, use numeric <abbr>UT</abbr> offsets like
    541  1.2  christos '<code>-</code>0600' instead of time zone abbreviations like 'CST'.
    542  1.1  christos </p>
    543  1.3  christos </section>
    544  1.1  christos 
    545  1.3  christos <section>
    546  1.3  christos   <h2 id="accuracy">Accuracy of the <code><abbr>tz</abbr></code> database</h2>
    547  1.1  christos <p>
    548  1.3  christos The <code><abbr>tz</abbr></code> database is not authoritative, and it
    549  1.3  christos surely has errors.
    550  1.2  christos Corrections are welcome and encouraged; see the file <code>CONTRIBUTING</code>.
    551  1.1  christos Users requiring authoritative data should consult national standards
    552  1.1  christos bodies and the references cited in the database's comments.
    553  1.1  christos </p>
    554  1.1  christos 
    555  1.1  christos <p>
    556  1.3  christos Errors in the <code><abbr>tz</abbr></code> database arise from many sources:
    557  1.1  christos </p>
    558  1.3  christos 
    559  1.1  christos <ul>
    560  1.1  christos   <li>
    561  1.3  christos     The <code><abbr>tz</abbr></code> database predicts future
    562  1.3  christos     timestamps, and current predictions
    563  1.3  christos     will be incorrect after future governments change the rules.
    564  1.3  christos     For example, if today someone schedules a meeting for 13:00 next
    565  1.3  christos     October 1, Casablanca time, and tomorrow Morocco changes its
    566  1.3  christos     daylight saving rules, software can mess up after the rule change
    567  1.3  christos     if it blithely relies on conversions made before the change.
    568  1.3  christos   </li>
    569  1.3  christos   <li>
    570  1.3  christos     The pre-1970 entries in this database cover only a tiny sliver of how
    571  1.3  christos     clocks actually behaved; the vast majority of the necessary
    572  1.3  christos     information was lost or never recorded.
    573  1.4  christos     Thousands more timezones would be needed if
    574  1.3  christos     the <code><abbr>tz</abbr></code> database's scope were extended to
    575  1.3  christos     cover even just the known or guessed history of standard time; for
    576  1.3  christos     example, the current single entry for France would need to split
    577  1.3  christos     into dozens of entries, perhaps hundreds.
    578  1.3  christos     And in most of the world even this approach would be misleading
    579  1.3  christos     due to widespread disagreement or indifference about what times
    580  1.3  christos     should be observed.
    581  1.3  christos     In her 2015 book
    582  1.3  christos     <cite><a
    583  1.3  christos     href="http://www.hup.harvard.edu/catalog.php?isbn=9780674286146">The
    584  1.3  christos     Global Transformation of Time, 1870&ndash;1950</a></cite>,
    585  1.3  christos     Vanessa Ogle writes
    586  1.3  christos     "Outside of Europe and North America there was no system of time
    587  1.3  christos     zones at all, often not even a stable landscape of mean times,
    588  1.3  christos     prior to the middle decades of the twentieth century".
    589  1.3  christos     See: Timothy Shenk, <a
    590  1.3  christos href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle">Booked:
    591  1.3  christos       A Global History of Time</a>. <cite>Dissent</cite> 2015-12-17.
    592  1.3  christos   </li>
    593  1.3  christos   <li>
    594  1.3  christos     Most of the pre-1970 data entries come from unreliable sources, often
    595  1.3  christos     astrology books that lack citations and whose compilers evidently
    596  1.3  christos     invented entries when the true facts were unknown, without
    597  1.3  christos     reporting which entries were known and which were invented.
    598  1.3  christos     These books often contradict each other or give implausible entries,
    599  1.3  christos     and on the rare occasions when they are checked they are
    600  1.3  christos     typically found to be incorrect.
    601  1.3  christos   </li>
    602  1.3  christos   <li>
    603  1.3  christos     For the UK the <code><abbr>tz</abbr></code> database relies on
    604  1.3  christos     years of first-class work done by
    605  1.3  christos     Joseph Myers and others; see
    606  1.3  christos     "<a href="https://www.polyomino.org.uk/british-time/">History of
    607  1.3  christos     legal time in Britain</a>".
    608  1.3  christos     Other countries are not done nearly as well.
    609  1.3  christos   </li>
    610  1.3  christos   <li>
    611  1.3  christos     Sometimes, different people in the same city maintain clocks
    612  1.3  christos     that differ significantly.
    613  1.3  christos     Historically, railway time was used by railroad companies (which
    614  1.3  christos     did not always
    615  1.3  christos     agree with each other), church-clock time was used for birth
    616  1.3  christos     certificates, etc.
    617  1.3  christos     More recently, competing political groups might disagree about
    618  1.3  christos     clock settings. Often this is merely common practice, but
    619  1.3  christos     sometimes it is set by law.
    620  1.3  christos     For example, from 1891 to 1911 the <abbr>UT</abbr> offset in France
    621  1.3  christos     was legally <abbr>UT</abbr> +00:09:21 outside train stations and
    622  1.3  christos     <abbr>UT</abbr> +00:04:21 inside. Other examples include
    623  1.3  christos     Chillicothe in 1920, Palm Springs in 1946/7, and Jerusalem and
    624  1.3  christos     rmqi to this day.
    625  1.3  christos   </li>
    626  1.3  christos   <li>
    627  1.3  christos     Although a named location in the <code><abbr>tz</abbr></code>
    628  1.3  christos     database stands for the containing region, its pre-1970 data
    629  1.3  christos     entries are often accurate for only a small subset of that region.
    630  1.3  christos     For example, <code>Europe/London</code> stands for the United
    631  1.3  christos     Kingdom, but its pre-1847 times are valid only for locations that
    632  1.3  christos     have London's exact meridian, and its 1847 transition
    633  1.3  christos     to <abbr>GMT</abbr> is known to be valid only for the L&amp;NW and
    634  1.3  christos     the Caledonian railways.
    635  1.3  christos   </li>
    636  1.3  christos   <li>
    637  1.3  christos     The <code><abbr>tz</abbr></code> database does not record the
    638  1.4  christos     earliest time for which a timezone's
    639  1.3  christos     data entries are thereafter valid for every location in the region.
    640  1.3  christos     For example, <code>Europe/London</code> is valid for all locations
    641  1.3  christos     in its region after <abbr>GMT</abbr> was made the standard time,
    642  1.3  christos     but the date of standardization (1880-08-02) is not in the
    643  1.3  christos     <code><abbr>tz</abbr></code> database, other than in commentary.
    644  1.4  christos     For many timezones the earliest time of
    645  1.3  christos     validity is unknown.
    646  1.3  christos   </li>
    647  1.3  christos   <li>
    648  1.3  christos     The <code><abbr>tz</abbr></code> database does not record a
    649  1.3  christos     region's boundaries, and in many cases the boundaries are not known.
    650  1.4  christos     For example, the timezone
    651  1.3  christos     <code>America/Kentucky/Louisville</code> represents a region
    652  1.3  christos     around the city of Louisville, the boundaries of which are
    653  1.3  christos     unclear.
    654  1.3  christos   </li>
    655  1.3  christos   <li>
    656  1.3  christos     Changes that are modeled as instantaneous transitions in the
    657  1.3  christos     <code><abbr>tz</abbr></code>
    658  1.3  christos     database were often spread out over hours, days, or even decades.
    659  1.3  christos   </li>
    660  1.3  christos   <li>
    661  1.3  christos     Even if the time is specified by law, locations sometimes
    662  1.3  christos     deliberately flout the law.
    663  1.3  christos   </li>
    664  1.3  christos   <li>
    665  1.3  christos     Early timekeeping practices, even assuming perfect clocks, were
    666  1.3  christos     often not specified to the accuracy that the
    667  1.3  christos     <code><abbr>tz</abbr></code> database requires.
    668  1.3  christos   </li>
    669  1.3  christos   <li>
    670  1.3  christos     Sometimes historical timekeeping was specified more precisely
    671  1.3  christos     than what the <code><abbr>tz</abbr></code> code can handle.
    672  1.3  christos     For example, from 1909 to 1937 <a
    673  1.3  christos     href="https://www.staff.science.uu.nl/~gent0113/wettijd/wettijd.htm"
    674  1.3  christos     hreflang="nl">Netherlands clocks</a> were legally Amsterdam Mean
    675  1.3  christos     Time (estimated to be <abbr>UT</abbr>
    676  1.3  christos     +00:19:32.13), but the <code><abbr>tz</abbr></code>
    677  1.3  christos     code cannot represent the fractional second.
    678  1.3  christos     In practice these old specifications were rarely if ever
    679  1.3  christos     implemented to subsecond precision.
    680  1.3  christos   </li>
    681  1.3  christos   <li>
    682  1.3  christos     Even when all the timestamp transitions recorded by the
    683  1.3  christos     <code><abbr>tz</abbr></code> database are correct, the
    684  1.3  christos     <code><abbr>tz</abbr></code> rules that generate them may not
    685  1.3  christos     faithfully reflect the historical rules.
    686  1.3  christos     For example, from 1922 until World War II the UK moved clocks
    687  1.3  christos     forward the day following the third Saturday in April unless that
    688  1.3  christos     was Easter, in which case it moved clocks forward the previous
    689  1.3  christos     Sunday.
    690  1.3  christos     Because the <code><abbr>tz</abbr></code> database has no
    691  1.3  christos     way to specify Easter, these exceptional years are entered as
    692  1.3  christos     separate <code><abbr>tz</abbr> Rule</code> lines, even though the
    693  1.3  christos     legal rules did not change.
    694  1.4  christos     When transitions are known but the historical rules behind them are not,
    695  1.4  christos     the database contains <code>Zone</code> and <code>Rule</code>
    696  1.4  christos     entries that are intended to represent only the generated
    697  1.4  christos     transitions, not any underlying historical rules; however, this
    698  1.4  christos     intent is recorded at best only in commentary.
    699  1.3  christos   </li>
    700  1.3  christos   <li>
    701  1.4  christos     The <code><abbr>tz</abbr></code> database models time
    702  1.3  christos     using the <a
    703  1.3  christos     href="https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">proleptic
    704  1.4  christos     Gregorian calendar</a> with days containing 24 equal-length hours
    705  1.4  christos     numbered 00 through 23, except when clock transitions occur.
    706  1.4  christos     Pre-standard time is modeled as local mean time.
    707  1.4  christos     However, historically many people used other calendars and other timescales.
    708  1.3  christos     For example, the Roman Empire used
    709  1.3  christos     the <a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian
    710  1.3  christos     calendar</a>,
    711  1.3  christos     and <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">Roman
    712  1.3  christos     timekeeping</a> had twelve varying-length daytime hours with a
    713  1.3  christos     non-hour-based system at night.
    714  1.4  christos     And even today, some local practices diverge from the Gregorian
    715  1.4  christos     calendar with 24-hour days. These divergences range from
    716  1.4  christos     relatively minor, such as Japanese bars giving times like "24:30" for the
    717  1.4  christos     wee hours of the morning, to more-significant differences such as <a
    718  1.4  christos     href="https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time">the
    719  1.4  christos     east African practice of starting the day at dawn</a>, renumbering
    720  1.4  christos     the Western 06:00 to be 12:00. These practices are largely outside
    721  1.4  christos     the scope of the <code><abbr>tz</abbr></code> code and data, which
    722  1.4  christos     provide only limited support for date and time localization
    723  1.4  christos     such as that required by POSIX. If DST is not used a different time zone
    724  1.4  christos     can often do the trick; for example, in Kenya a <code>TZ</code> setting
    725  1.4  christos     like <code>&lt;-03&gt;3</code> or <code>America/Cayenne</code> starts
    726  1.4  christos     the day six hours later than <code>Africa/Nairobi</code> does.
    727  1.3  christos   </li>
    728  1.3  christos   <li>
    729  1.3  christos     Early clocks were less reliable, and data entries do not represent
    730  1.3  christos     clock error.
    731  1.3  christos   </li>
    732  1.3  christos   <li>
    733  1.3  christos     The <code><abbr>tz</abbr></code> database assumes Universal Time
    734  1.3  christos     (<abbr>UT</abbr>) as an origin, even though <abbr>UT</abbr> is not
    735  1.3  christos     standardized for older timestamps.
    736  1.3  christos     In the <code><abbr>tz</abbr></code> database commentary,
    737  1.3  christos     <abbr>UT</abbr> denotes a family of time standards that includes
    738  1.3  christos     Coordinated Universal Time (<abbr>UTC</abbr>) along with other
    739  1.3  christos     variants such as <abbr>UT1</abbr> and <abbr>GMT</abbr>,
    740  1.3  christos     with days starting at midnight.
    741  1.3  christos     Although <abbr>UT</abbr> equals <abbr>UTC</abbr> for modern
    742  1.3  christos     timestamps, <abbr>UTC</abbr> was not defined until 1960, so
    743  1.3  christos     commentary uses the more-general abbreviation <abbr>UT</abbr> for
    744  1.3  christos     timestamps that might predate 1960.
    745  1.3  christos     Since <abbr>UT</abbr>, <abbr>UT1</abbr>, etc. disagree slightly,
    746  1.3  christos     and since pre-1972 <abbr>UTC</abbr> seconds varied in length,
    747  1.3  christos     interpretation of older timestamps can be problematic when
    748  1.3  christos     subsecond accuracy is needed.
    749  1.3  christos   </li>
    750  1.3  christos   <li>
    751  1.3  christos     Civil time was not based on atomic time before 1972, and we do not
    752  1.3  christos     know the history of
    753  1.3  christos     <a href="https://en.wikipedia.org/wiki/Earth's_rotation">earth's
    754  1.3  christos     rotation</a> accurately enough to map <a
    755  1.3  christos     href="https://en.wikipedia.org/wiki/International_System_of_Units"><abbr
    756  1.3  christos     title="International System of Units">SI</abbr></a> seconds to
    757  1.3  christos     historical <a href="https://en.wikipedia.org/wiki/Solar_time">solar time</a>
    758  1.3  christos     to more than about one-hour accuracy.
    759  1.3  christos     See: Stephenson FR, Morrison LV, Hohenkerk CY.
    760  1.4  christos     <a href="https://dx.doi.org/10.1098/rspa.2016.0404">Measurement of
    761  1.3  christos     the Earth's rotation: 720 BC to AD 2015</a>.
    762  1.3  christos     <cite>Proc Royal Soc A</cite>. 2016 Dec 7;472:20160404.
    763  1.3  christos     Also see: Espenak F. <a
    764  1.3  christos     href="https://eclipse.gsfc.nasa.gov/SEhelp/uncertainty2004.html">Uncertainty
    765  1.3  christos     in Delta T (T)</a>.
    766  1.3  christos   </li>
    767  1.3  christos   <li>
    768  1.3  christos     The relationship between POSIX time (that is, <abbr>UTC</abbr> but
    769  1.3  christos     ignoring <a href="https://en.wikipedia.org/wiki/Leap_second">leap
    770  1.3  christos     seconds</a>) and <abbr>UTC</abbr> is not agreed upon after 1972.
    771  1.3  christos     Although the POSIX
    772  1.3  christos     clock officially stops during an inserted leap second, at least one
    773  1.3  christos     proposed standard has it jumping back a second instead; and in
    774  1.3  christos     practice POSIX clocks more typically either progress glacially during
    775  1.3  christos     a leap second, or are slightly slowed while near a leap second.
    776  1.3  christos   </li>
    777  1.3  christos   <li>
    778  1.3  christos     The <code><abbr>tz</abbr></code> database does not represent how
    779  1.3  christos     uncertain its information is.
    780  1.3  christos     Ideally it would contain information about when data entries are
    781  1.3  christos     incomplete or dicey.
    782  1.3  christos     Partial temporal knowledge is a field of active research, though,
    783  1.3  christos     and it is not clear how to apply it here.
    784  1.1  christos   </li>
    785  1.1  christos </ul>
    786  1.1  christos 
    787  1.1  christos <p>
    788  1.3  christos In short, many, perhaps most, of the <code><abbr>tz</abbr></code>
    789  1.3  christos database's pre-1970 and future timestamps are either wrong or
    790  1.3  christos misleading.
    791  1.3  christos Any attempt to pass the
    792  1.3  christos <code><abbr>tz</abbr></code> database off as the definition of time
    793  1.3  christos should be unacceptable to anybody who cares about the facts.
    794  1.3  christos In particular, the <code><abbr>tz</abbr></code> database's
    795  1.3  christos <abbr>LMT</abbr> offsets should not be considered meaningful, and
    796  1.4  christos should not prompt creation of timezones
    797  1.3  christos merely because two locations
    798  1.3  christos differ in <abbr>LMT</abbr> or transitioned to standard time at
    799  1.3  christos different dates.
    800  1.3  christos </p>
    801  1.3  christos </section>
    802  1.3  christos 
    803  1.3  christos <section>
    804  1.3  christos   <h2 id="functions">Time and date functions</h2>
    805  1.3  christos <p>
    806  1.3  christos The <code><abbr>tz</abbr></code> code contains time and date functions
    807  1.3  christos that are upwards compatible with those of POSIX.
    808  1.3  christos Code compatible with this package is already
    809  1.3  christos <a href="tz-link.html#tzdb">part of many platforms</a>, where the
    810  1.3  christos primary use of this package is to update obsolete time-related files.
    811  1.3  christos To do this, you may need to compile the time zone compiler
    812  1.3  christos '<code>zic</code>' supplied with this package instead of using the
    813  1.3  christos system '<code>zic</code>', since the format of <code>zic</code>'s
    814  1.3  christos input is occasionally extended, and a platform may still be shipping
    815  1.3  christos an older <code>zic</code>.
    816  1.1  christos </p>
    817  1.1  christos 
    818  1.3  christos <h3 id="POSIX">POSIX properties and limitations</h3>
    819  1.1  christos <ul>
    820  1.1  christos   <li>
    821  1.1  christos     <p>
    822  1.3  christos     In POSIX, time display in a process is controlled by the
    823  1.3  christos     environment variable <code>TZ</code>.
    824  1.3  christos     Unfortunately, the POSIX
    825  1.3  christos     <code>TZ</code> string takes a form that is hard to describe and
    826  1.3  christos     is error-prone in practice.
    827  1.3  christos     Also, POSIX <code>TZ</code> strings cannot deal with daylight
    828  1.3  christos     saving time rules not based on the Gregorian calendar (as in
    829  1.3  christos     Iran), or with situations where more than two time zone
    830  1.3  christos     abbreviations or <abbr>UT</abbr> offsets are used in an area.
    831  1.1  christos     </p>
    832  1.3  christos 
    833  1.1  christos     <p>
    834  1.3  christos     The POSIX <code>TZ</code> string takes the following form:
    835  1.1  christos     </p>
    836  1.3  christos 
    837  1.1  christos     <p>
    838  1.3  christos     <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>]]]
    839  1.1  christos     </p>
    840  1.3  christos 
    841  1.1  christos     <p>
    842  1.3  christos     where:
    843  1.3  christos     </p>
    844  1.3  christos 
    845  1.1  christos     <dl>
    846  1.1  christos       <dt><var>std</var> and <var>dst</var></dt><dd>
    847  1.3  christos 	are 3 or more characters specifying the standard
    848  1.4  christos 	and daylight saving time (<abbr>DST</abbr>) zone abbreviations.
    849  1.3  christos 	Starting with POSIX.1-2001, <var>std</var> and <var>dst</var>
    850  1.3  christos 	may also be in a quoted form like '<code>&lt;+09&gt;</code>';
    851  1.3  christos 	this allows "<code>+</code>" and "<code>-</code>" in the names.
    852  1.1  christos       </dd>
    853  1.1  christos       <dt><var>offset</var></dt><dd>
    854  1.3  christos 	is of the form
    855  1.3  christos 	'<code>[&plusmn;]<var>hh</var>:[<var>mm</var>[:<var>ss</var>]]</code>'
    856  1.3  christos 	and specifies the offset west of <abbr>UT</abbr>.
    857  1.3  christos 	'<var>hh</var>' may be a single digit;
    858  1.3  christos 	0&le;<var>hh</var>&le;24.
    859  1.3  christos 	The default <abbr>DST</abbr> offset is one hour ahead of
    860  1.3  christos 	standard time.
    861  1.1  christos       </dd>
    862  1.1  christos       <dt><var>date</var>[<code>/</code><var>time</var>]<code>,</code><var>date</var>[<code>/</code><var>time</var>]</dt><dd>
    863  1.3  christos 	specifies the beginning and end of <abbr>DST</abbr>.
    864  1.3  christos 	If this is absent, the system supplies its own ruleset
    865  1.3  christos 	for <abbr>DST</abbr>, and its rules can differ from year to year;
    866  1.3  christos 	typically <abbr>US</abbr> <abbr>DST</abbr> rules are used.
    867  1.1  christos       </dd>
    868  1.1  christos       <dt><var>time</var></dt><dd>
    869  1.3  christos 	takes the form
    870  1.3  christos 	'<var>hh</var><code>:</code>[<var>mm</var>[<code>:</code><var>ss</var>]]'
    871  1.3  christos 	and defaults to 02:00.
    872  1.3  christos 	This is the same format as the offset, except that a
    873  1.3  christos 	leading '<code>+</code>' or '<code>-</code>' is not allowed.
    874  1.1  christos       </dd>
    875  1.1  christos       <dt><var>date</var></dt><dd>
    876  1.3  christos 	takes one of the following forms:
    877  1.1  christos 	<dl>
    878  1.1  christos 	  <dt>J<var>n</var> (1&le;<var>n</var>&le;365)</dt><dd>
    879  1.3  christos 	    origin-1 day number not counting February 29
    880  1.3  christos 	  </dd>
    881  1.1  christos 	  <dt><var>n</var> (0&le;<var>n</var>&le;365)</dt><dd>
    882  1.3  christos 	    origin-0 day number counting February 29 if present
    883  1.3  christos 	  </dd>
    884  1.3  christos 	  <dt><code>M</code><var>m</var><code>.</code><var>n</var><code>.</code><var>d</var>
    885  1.3  christos 	    (0[Sunday]&le;<var>d</var>&le;6[Saturday], 1&le;<var>n</var>&le;5,
    886  1.3  christos 	    1&le;<var>m</var>&le;12)</dt><dd>
    887  1.3  christos 	    for the <var>d</var>th day of week <var>n</var> of
    888  1.3  christos 	    month <var>m</var> of the year, where week 1 is the first
    889  1.3  christos 	    week in which day <var>d</var> appears, and
    890  1.3  christos 	    '<code>5</code>' stands for the last week in which
    891  1.3  christos 	    day <var>d</var> appears (which may be either the 4th or
    892  1.3  christos 	    5th week).
    893  1.3  christos 	    Typically, this is the only useful form; the <var>n</var>
    894  1.3  christos 	    and <code>J</code><var>n</var> forms are rarely used.
    895  1.1  christos 	  </dd>
    896  1.3  christos 	</dl>
    897  1.3  christos       </dd>
    898  1.3  christos     </dl>
    899  1.3  christos 
    900  1.3  christos     <p>
    901  1.3  christos     Here is an example POSIX <code>TZ</code> string for New
    902  1.3  christos     Zealand after 2007.
    903  1.3  christos     It says that standard time (<abbr>NZST</abbr>) is 12 hours ahead
    904  1.3  christos     of <abbr>UT</abbr>, and that daylight saving time
    905  1.3  christos     (<abbr>NZDT</abbr>) is observed from September's last Sunday at
    906  1.3  christos     02:00 until April's first Sunday at 03:00:
    907  1.3  christos     </p>
    908  1.3  christos 
    909  1.3  christos     <pre><code>TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'</code></pre>
    910  1.3  christos 
    911  1.3  christos     <p>
    912  1.3  christos     This POSIX <code>TZ</code> string is hard to remember, and
    913  1.3  christos     mishandles some timestamps before 2008.
    914  1.3  christos     With this package you can use this instead:
    915  1.3  christos     </p>
    916  1.3  christos 
    917  1.3  christos     <pre><code>TZ='Pacific/Auckland'</code></pre>
    918  1.3  christos   </li>
    919  1.3  christos   <li>
    920  1.4  christos     POSIX does not define the <abbr>DST</abbr> transitions
    921  1.4  christos     for <code>TZ</code> values like
    922  1.3  christos     "<code>EST5EDT</code>".
    923  1.4  christos     Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
    924  1.4  christos     were used to interpret such values, but this meant that the
    925  1.4  christos     <abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
    926  1.4  christos     program that did time conversion. This meant that when
    927  1.4  christos     <abbr>US</abbr> time conversion rules changed (as in the United
    928  1.4  christos     States in 1987), all programs that did time conversion had to be
    929  1.3  christos     recompiled to ensure proper results.
    930  1.3  christos   </li>
    931  1.3  christos   <li>
    932  1.3  christos     The <code>TZ</code> environment variable is process-global, which
    933  1.3  christos     makes it hard to write efficient, thread-safe applications that
    934  1.4  christos     need access to multiple timezones.
    935  1.3  christos   </li>
    936  1.3  christos   <li>
    937  1.3  christos     In POSIX, there is no tamper-proof way for a process to learn the
    938  1.3  christos     system's best idea of local wall clock.
    939  1.4  christos     This is important for applications that an administrator wants
    940  1.3  christos     used only at certain times &ndash; without regard to whether the
    941  1.3  christos     user has fiddled the
    942  1.3  christos     <code>TZ</code> environment variable.
    943  1.3  christos     While an administrator can "do everything in <abbr>UT</abbr>" to
    944  1.3  christos     get around the problem, doing so is inconvenient and precludes
    945  1.4  christos     handling daylight saving time shifts &ndash; as might be required to
    946  1.4  christos     limit phone calls to off-peak hours.
    947  1.3  christos   </li>
    948  1.3  christos   <li>
    949  1.3  christos     POSIX provides no convenient and efficient way to determine
    950  1.3  christos     the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
    951  1.4  christos     timestamps, particularly for timezones
    952  1.3  christos     that do not fit into the POSIX model.
    953  1.3  christos   </li>
    954  1.3  christos   <li>
    955  1.3  christos     POSIX requires that systems ignore leap seconds.
    956  1.3  christos   </li>
    957  1.3  christos   <li>
    958  1.3  christos     The <code><abbr>tz</abbr></code> code attempts to support all the
    959  1.3  christos     <code>time_t</code> implementations allowed by POSIX.
    960  1.3  christos     The <code>time_t</code> type represents a nonnegative count of seconds
    961  1.3  christos     since 1970-01-01 00:00:00 <abbr>UTC</abbr>, ignoring leap seconds.
    962  1.3  christos     In practice, <code>time_t</code> is usually a signed 64- or 32-bit
    963  1.3  christos     integer; 32-bit signed <code>time_t</code> values stop working after
    964  1.3  christos     2038-01-19 03:14:07 <abbr>UTC</abbr>, so new implementations these
    965  1.3  christos     days typically use a signed 64-bit integer.
    966  1.3  christos     Unsigned 32-bit integers are used on one or two platforms, and 36-bit
    967  1.3  christos     and 40-bit integers are also used occasionally.
    968  1.3  christos     Although earlier POSIX versions allowed <code>time_t</code> to be a
    969  1.4  christos     floating-point type, this was not supported by any practical system,
    970  1.3  christos     and POSIX.1-2013 and the <code><abbr>tz</abbr></code> code both
    971  1.3  christos     require <code>time_t</code> to be an integer type.
    972  1.1  christos   </li>
    973  1.1  christos </ul>
    974  1.3  christos 
    975  1.3  christos <h3 id="POSIX-extensions">Extensions to POSIX in the
    976  1.3  christos <code><abbr>tz</abbr></code> code</h3>
    977  1.1  christos <ul>
    978  1.1  christos   <li>
    979  1.1  christos     <p>
    980  1.3  christos     The <code>TZ</code> environment variable is used in generating
    981  1.4  christos     the name of a file from which time-related information is read
    982  1.3  christos     (or is interpreted  la POSIX); <code>TZ</code> is no longer
    983  1.4  christos     constrained to be a string containing abbreviations
    984  1.4  christos     and numeric data as described <a href="#POSIX">above</a>.
    985  1.4  christos     The file's format is <dfn><abbr>TZif</abbr></dfn>,
    986  1.4  christos     a timezone information format that contains binary data.
    987  1.3  christos     The daylight saving time rules to be used for a
    988  1.4  christos     particular timezone are encoded in the
    989  1.4  christos     <abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
    990  1.4  christos     Australian, and other rules to be encoded, and
    991  1.3  christos     allows for situations where more than two time zone
    992  1.3  christos     abbreviations are used.
    993  1.1  christos     </p>
    994  1.1  christos     <p>
    995  1.3  christos     It was recognized that allowing the <code>TZ</code> environment
    996  1.3  christos     variable to take on values such as '<code>America/New_York</code>'
    997  1.3  christos     might cause "old" programs (that expect <code>TZ</code> to have a
    998  1.3  christos     certain form) to operate incorrectly; consideration was given to using
    999  1.3  christos     some other environment variable (for example, <code>TIMEZONE</code>)
   1000  1.4  christos     to hold the string used to generate the <abbr>TZif</abbr> file's name.
   1001  1.3  christos     In the end, however, it was decided to continue using
   1002  1.3  christos     <code>TZ</code>: it is widely used for time zone purposes;
   1003  1.3  christos     separately maintaining both <code>TZ</code>
   1004  1.3  christos     and <code>TIMEZONE</code> seemed a nuisance; and systems where
   1005  1.3  christos     "new" forms of <code>TZ</code> might cause problems can simply
   1006  1.4  christos     use legacy <code>TZ</code> values such as "<code>EST5EDT</code>" which
   1007  1.4  christos     can be used by "new" programs as well as by "old" programs that
   1008  1.4  christos     assume pre-POSIX <code>TZ</code> values.
   1009  1.1  christos     </p>
   1010  1.3  christos   </li>
   1011  1.3  christos   <li>
   1012  1.3  christos     The code supports platforms with a <abbr>UT</abbr> offset member
   1013  1.3  christos     in <code>struct tm</code>, e.g., <code>tm_gmtoff</code>.
   1014  1.3  christos   </li>
   1015  1.3  christos   <li>
   1016  1.3  christos     The code supports platforms with a time zone abbreviation member in
   1017  1.3  christos     <code>struct tm</code>, e.g., <code>tm_zone</code>.
   1018  1.3  christos   </li>
   1019  1.3  christos   <li>
   1020  1.3  christos     Functions <code>tzalloc</code>, <code>tzfree</code>,
   1021  1.3  christos     <code>localtime_rz</code>, and <code>mktime_z</code> for
   1022  1.3  christos     more-efficient thread-safe applications that need to use multiple
   1023  1.4  christos     timezones.
   1024  1.3  christos     The <code>tzalloc</code> and <code>tzfree</code> functions
   1025  1.3  christos     allocate and free objects of type <code>timezone_t</code>,
   1026  1.3  christos     and <code>localtime_rz</code> and <code>mktime_z</code> are
   1027  1.3  christos     like <code>localtime_r</code> and <code>mktime</code> with an
   1028  1.3  christos     extra <code>timezone_t</code> argument.
   1029  1.3  christos     The functions were inspired by <a href="https://netbsd.org/">NetBSD</a>.
   1030  1.3  christos   </li>
   1031  1.3  christos   <li>
   1032  1.3  christos     A function <code>tzsetwall</code> has been added to arrange for the
   1033  1.3  christos     system's best approximation to local wall clock time to be delivered
   1034  1.3  christos     by subsequent calls to <code>localtime</code>.
   1035  1.3  christos     Source code for portable applications that "must" run on local wall
   1036  1.3  christos     clock time should call <code>tzsetwall</code>;
   1037  1.3  christos     if such code is moved to "old" systems that do not
   1038  1.3  christos     provide <code>tzsetwall</code>, you will not be able to generate an
   1039  1.3  christos     executable program.
   1040  1.3  christos     (These functions also arrange for local wall clock time to
   1041  1.3  christos     be used if <code>tzset</code> is called &ndash; directly or
   1042  1.3  christos     indirectly &ndash; and there is no <code>TZ</code> environment
   1043  1.3  christos     variable; portable applications should not, however, rely on this
   1044  1.3  christos     behavior since it is not the way <a
   1045  1.3  christos     href="https://en.wikipedia.org/wiki/UNIX_System_V#SVR2"><abbr>SVR2</abbr></a>
   1046  1.3  christos     systems behave.)
   1047  1.3  christos   </li>
   1048  1.3  christos   <li>
   1049  1.3  christos     Negative <code>time_t</code> values are supported, on systems
   1050  1.3  christos     where <code>time_t</code> is signed.
   1051  1.3  christos   </li>
   1052  1.3  christos   <li>
   1053  1.3  christos     These functions can account for leap seconds, thanks to Bradley White.
   1054  1.3  christos   </li>
   1055  1.1  christos </ul>
   1056  1.3  christos 
   1057  1.3  christos <h3 id="vestigial">POSIX features no longer needed</h3>
   1058  1.1  christos <p>
   1059  1.3  christos POSIX and <a href="https://en.wikipedia.org/wiki/ISO_C"><abbr>ISO</abbr> C</a>
   1060  1.3  christos define some <a href="https://en.wikipedia.org/wiki/API"><abbr
   1061  1.3  christos title="application programming interface">API</abbr>s</a> that are vestigial:
   1062  1.3  christos they are not needed, and are relics of a too-simple model that does
   1063  1.3  christos not suffice to handle many real-world timestamps.
   1064  1.3  christos Although the <code><abbr>tz</abbr></code> code supports these
   1065  1.3  christos vestigial <abbr>API</abbr>s for backwards compatibility, they should
   1066  1.3  christos be avoided in portable applications.
   1067  1.3  christos The vestigial <abbr>API</abbr>s are:
   1068  1.1  christos </p>
   1069  1.1  christos <ul>
   1070  1.1  christos   <li>
   1071  1.3  christos     The POSIX <code>tzname</code> variable does not suffice and is no
   1072  1.3  christos     longer needed.
   1073  1.3  christos     To get a timestamp's time zone abbreviation, consult
   1074  1.3  christos     the <code>tm_zone</code> member if available; otherwise,
   1075  1.3  christos     use <code>strftime</code>'s <code>"%Z"</code> conversion
   1076  1.3  christos     specification.
   1077  1.3  christos   </li>
   1078  1.3  christos   <li>
   1079  1.3  christos     The POSIX <code>daylight</code> and <code>timezone</code>
   1080  1.3  christos     variables do not suffice and are no longer needed.
   1081  1.3  christos     To get a timestamp's <abbr>UT</abbr> offset, consult
   1082  1.3  christos     the <code>tm_gmtoff</code> member if available; otherwise,
   1083  1.3  christos     subtract values returned by <code>localtime</code>
   1084  1.3  christos     and <code>gmtime</code> using the rules of the Gregorian calendar,
   1085  1.3  christos     or use <code>strftime</code>'s <code>"%z"</code> conversion
   1086  1.3  christos     specification if a string like <code>"+0900"</code> suffices.
   1087  1.3  christos   </li>
   1088  1.3  christos   <li>
   1089  1.3  christos     The <code>tm_isdst</code> member is almost never needed and most of
   1090  1.3  christos     its uses should be discouraged in favor of the abovementioned
   1091  1.3  christos     <abbr>API</abbr>s.
   1092  1.3  christos     Although it can still be used in arguments to
   1093  1.3  christos     <code>mktime</code> to disambiguate timestamps near
   1094  1.3  christos     a <abbr>DST</abbr> transition when the clock jumps back, this
   1095  1.3  christos     disambiguation does not work when standard time itself jumps back,
   1096  1.3  christos     which can occur when a location changes to a time zone with a
   1097  1.3  christos     lesser <abbr>UT</abbr> offset.
   1098  1.3  christos   </li>
   1099  1.3  christos </ul>
   1100  1.3  christos 
   1101  1.3  christos <h3 id="other-portability">Other portability notes</h3>
   1102  1.3  christos <ul>
   1103  1.3  christos   <li>
   1104  1.3  christos     The <a href="https://en.wikipedia.org/wiki/Version_7_Unix">7th Edition
   1105  1.3  christos     UNIX</a> <code>timezone</code> function is not present in this
   1106  1.3  christos     package; it is impossible to reliably map <code>timezone</code>'s
   1107  1.3  christos     arguments (a "minutes west of <abbr>GMT</abbr>" value and a
   1108  1.3  christos     "daylight saving time in effect" flag) to a time zone
   1109  1.3  christos     abbreviation, and we refuse to guess.
   1110  1.3  christos     Programs that in the past used the <code>timezone</code> function
   1111  1.3  christos     may now examine <code>localtime(&amp;clock)-&gt;tm_zone</code>
   1112  1.3  christos     (if <code>TM_ZONE</code> is defined) or
   1113  1.3  christos     <code>tzname[localtime(&amp;clock)-&gt;tm_isdst]</code>
   1114  1.3  christos     (if <code>HAVE_TZNAME</code> is defined) to learn the correct time
   1115  1.3  christos     zone abbreviation to use.
   1116  1.3  christos   </li>
   1117  1.3  christos   <li>
   1118  1.3  christos     The <a
   1119  1.3  christos     href="https://en.wikipedia.org/wiki/History_of_the_Berkeley_Software_Distribution#4.2BSD"><abbr>4.2BSD</abbr></a>
   1120  1.3  christos     <code>gettimeofday</code> function is not
   1121  1.3  christos     used in this package.
   1122  1.3  christos     This formerly let users obtain the current <abbr>UTC</abbr> offset
   1123  1.3  christos     and <abbr>DST</abbr> flag, but this functionality was removed in
   1124  1.3  christos     later versions of <abbr>BSD</abbr>.
   1125  1.3  christos   </li>
   1126  1.3  christos   <li>
   1127  1.3  christos     In <abbr>SVR2</abbr>, time conversion fails for near-minimum or
   1128  1.3  christos     near-maximum <code>time_t</code> values when doing conversions
   1129  1.3  christos     for places that do not use <abbr>UT</abbr>.
   1130  1.3  christos     This package takes care to do these conversions correctly.
   1131  1.3  christos     A comment in the source code tells how to get compatibly wrong
   1132  1.3  christos     results.
   1133  1.3  christos   </li>
   1134  1.3  christos   <li>
   1135  1.3  christos     The functions that are conditionally compiled
   1136  1.3  christos     if <code>STD_INSPIRED</code> is defined should, at this point, be
   1137  1.3  christos     looked on primarily as food for thought.
   1138  1.3  christos     They are not in any sense "standard compatible" &ndash; some are
   1139  1.3  christos     not, in fact, specified in <em>any</em> standard.
   1140  1.3  christos     They do, however, represent responses of various authors to
   1141  1.3  christos     standardization proposals.
   1142  1.3  christos   </li>
   1143  1.3  christos   <li>
   1144  1.4  christos     Other time conversion proposals, in particular those supported by the
   1145  1.4  christos     <a href="https://howardhinnant.github.io/date/tz.html">Time Zone
   1146  1.4  christos     Database Parser</a>, offer a wider selection of functions
   1147  1.3  christos     that provide capabilities beyond those provided here.
   1148  1.3  christos     The absence of such functions from this package is not meant to
   1149  1.3  christos     discourage the development, standardization, or use of such
   1150  1.3  christos     functions.
   1151  1.3  christos     Rather, their absence reflects the decision to make this package
   1152  1.3  christos     contain valid extensions to POSIX, to ensure its broad
   1153  1.3  christos     acceptability.
   1154  1.3  christos     If more powerful time conversion functions can be standardized, so
   1155  1.3  christos     much the better.
   1156  1.1  christos   </li>
   1157  1.1  christos </ul>
   1158  1.3  christos </section>
   1159  1.1  christos 
   1160  1.3  christos <section>
   1161  1.3  christos   <h2 id="stability">Interface stability</h2>
   1162  1.1  christos <p>
   1163  1.3  christos The <code><abbr>tz</abbr></code> code and data supply the following interfaces:
   1164  1.1  christos </p>
   1165  1.1  christos 
   1166  1.1  christos <ul>
   1167  1.1  christos   <li>
   1168  1.4  christos     A set of timezone names as per
   1169  1.4  christos       "<a href="#naming">Names of timezones</a>" above.
   1170  1.1  christos   </li>
   1171  1.1  christos   <li>
   1172  1.3  christos     Library functions described in "<a href="#functions">Time and date
   1173  1.3  christos       functions</a>" above.
   1174  1.1  christos   </li>
   1175  1.1  christos   <li>
   1176  1.3  christos     The programs <code>tzselect</code>, <code>zdump</code>,
   1177  1.3  christos     and <code>zic</code>, documented in their man pages.
   1178  1.1  christos   </li>
   1179  1.1  christos   <li>
   1180  1.3  christos     The format of <code>zic</code> input files, documented in
   1181  1.3  christos     the <code>zic</code> man page.
   1182  1.1  christos   </li>
   1183  1.1  christos   <li>
   1184  1.3  christos     The format of <code>zic</code> output files, documented in
   1185  1.3  christos     the <code>tzfile</code> man page.
   1186  1.1  christos   </li>
   1187  1.1  christos   <li>
   1188  1.3  christos     The format of zone table files, documented in <code>zone1970.tab</code>.
   1189  1.1  christos   </li>
   1190  1.1  christos   <li>
   1191  1.3  christos     The format of the country code file, documented in <code>iso3166.tab</code>.
   1192  1.1  christos   </li>
   1193  1.1  christos   <li>
   1194  1.3  christos     The version number of the code and data, as the first line of
   1195  1.3  christos     the text file '<code>version</code>' in each release.
   1196  1.1  christos   </li>
   1197  1.1  christos </ul>
   1198  1.3  christos 
   1199  1.1  christos <p>
   1200  1.1  christos Interface changes in a release attempt to preserve compatibility with
   1201  1.3  christos recent releases.
   1202  1.3  christos For example, <code><abbr>tz</abbr></code> data files typically do not
   1203  1.3  christos rely on recently-added <code>zic</code> features, so that users can
   1204  1.3  christos run older <code>zic</code> versions to process newer data files.
   1205  1.3  christos <a href="tz-link.html#download">Downloading
   1206  1.3  christos the <code><abbr>tz</abbr></code> database</a> describes how releases
   1207  1.3  christos are tagged and distributed.
   1208  1.1  christos </p>
   1209  1.1  christos 
   1210  1.1  christos <p>
   1211  1.3  christos Interfaces not listed above are less stable.
   1212  1.3  christos For example, users should not rely on particular <abbr>UT</abbr>
   1213  1.3  christos offsets or abbreviations for timestamps, as data entries are often
   1214  1.3  christos based on guesswork and these guesses may be corrected or improved.
   1215  1.1  christos </p>
   1216  1.3  christos </section>
   1217  1.1  christos 
   1218  1.3  christos <section>
   1219  1.3  christos   <h2 id="calendar">Calendrical issues</h2>
   1220  1.1  christos <p>
   1221  1.1  christos Calendrical issues are a bit out of scope for a time zone database,
   1222  1.1  christos but they indicate the sort of problems that we would run into if we
   1223  1.3  christos extended the time zone database further into the past.
   1224  1.3  christos An excellent resource in this area is Edward M. Reingold
   1225  1.3  christos and Nachum Dershowitz, <cite><a
   1226  1.3  christos href="https://www.cambridge.org/fr/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition">Calendrical
   1227  1.3  christos Calculations: The Ultimate Edition</a></cite>, Cambridge University Press (2018).
   1228  1.3  christos Other information and sources are given in the file '<code>calendars</code>'
   1229  1.3  christos in the <code><abbr>tz</abbr></code> distribution.
   1230  1.3  christos They sometimes disagree.
   1231  1.3  christos </p>
   1232  1.3  christos </section>
   1233  1.3  christos 
   1234  1.3  christos <section>
   1235  1.3  christos   <h2 id="planets">Time and time zones on other planets</h2>
   1236  1.3  christos <p>
   1237  1.3  christos Some people's work schedules
   1238  1.4  christos use <a href="https://en.wikipedia.org/wiki/Timekeeping_on_Mars">Mars time</a>.
   1239  1.3  christos Jet Propulsion Laboratory (JPL) coordinators kept Mars time on
   1240  1.3  christos and off during the
   1241  1.3  christos <a href="https://en.wikipedia.org/wiki/Mars_Pathfinder#End_of_mission">Mars
   1242  1.3  christos Pathfinder</a> mission.
   1243  1.3  christos Some of their family members also adapted to Mars time.
   1244  1.3  christos Dozens of special Mars watches were built for JPL workers who kept
   1245  1.3  christos Mars time during the Mars Exploration Rovers mission (2004).
   1246  1.3  christos These timepieces look like normal Seikos and Citizens but use Mars
   1247  1.3  christos seconds rather than terrestrial seconds.
   1248  1.1  christos </p>
   1249  1.1  christos 
   1250  1.1  christos <p>
   1251  1.1  christos A Mars solar day is called a "sol" and has a mean period equal to
   1252  1.3  christos about 24 hours 39 minutes 35.244 seconds in terrestrial time.
   1253  1.3  christos It is divided into a conventional 24-hour clock, so each Mars second
   1254  1.3  christos equals about 1.02749125 terrestrial seconds.
   1255  1.1  christos </p>
   1256  1.1  christos 
   1257  1.1  christos <p>
   1258  1.3  christos The <a href="https://en.wikipedia.org/wiki/Prime_meridian">prime
   1259  1.3  christos meridian</a> of Mars goes through the center of the crater
   1260  1.3  christos <a href="https://en.wikipedia.org/wiki/Airy-0">Airy-0</a>, named in
   1261  1.3  christos honor of the British astronomer who built the Greenwich telescope that
   1262  1.3  christos defines Earth's prime meridian.
   1263  1.3  christos Mean solar time on the Mars prime meridian is
   1264  1.3  christos called <a href="https://en.wikipedia.org/wiki/Mars_Coordinated_Time">Mars
   1265  1.3  christos Coordinated Time (<abbr>MTC</abbr>)</a>.
   1266  1.1  christos </p>
   1267  1.1  christos 
   1268  1.1  christos <p>
   1269  1.1  christos Each landed mission on Mars has adopted a different reference for
   1270  1.4  christos solar timekeeping, so there is no real standard for Mars time zones.
   1271  1.3  christos For example, the
   1272  1.3  christos <a href="https://en.wikipedia.org/wiki/Mars_Exploration_Rover">Mars
   1273  1.3  christos Exploration Rover</a> project (2004) defined two time zones "Local
   1274  1.3  christos Solar Time A" and "Local Solar Time B" for its two missions, each zone
   1275  1.3  christos designed so that its time equals local true solar time at
   1276  1.3  christos approximately the middle of the nominal mission.
   1277  1.3  christos Such a "time zone" is not particularly suited for any application
   1278  1.3  christos other than the mission itself.
   1279  1.1  christos </p>
   1280  1.1  christos 
   1281  1.1  christos <p>
   1282  1.1  christos Many calendars have been proposed for Mars, but none have achieved
   1283  1.3  christos wide acceptance.
   1284  1.3  christos Astronomers often use Mars Sol Date (<abbr>MSD</abbr>) which is a
   1285  1.1  christos sequential count of Mars solar days elapsed since about 1873-12-29
   1286  1.3  christos 12:00 <abbr>GMT</abbr>.
   1287  1.1  christos </p>
   1288  1.1  christos 
   1289  1.1  christos <p>
   1290  1.1  christos In our solar system, Mars is the planet with time and calendar most
   1291  1.3  christos like Earth's.
   1292  1.3  christos On other planets, Sun-based time and calendars would work quite
   1293  1.3  christos differently.
   1294  1.3  christos For example, although Mercury's
   1295  1.3  christos <a href="https://en.wikipedia.org/wiki/Rotation_period">sidereal
   1296  1.3  christos rotation period</a> is 58.646 Earth days, Mercury revolves around the
   1297  1.3  christos Sun so rapidly that an observer on Mercury's equator would see a
   1298  1.3  christos sunrise only every 175.97 Earth days, i.e., a Mercury year is 0.5 of a
   1299  1.3  christos Mercury day.
   1300  1.3  christos Venus is more complicated, partly because its rotation is slightly
   1301  1.3  christos <a href="https://en.wikipedia.org/wiki/Retrograde_motion">retrograde</a>:
   1302  1.3  christos its year is 1.92 of its days.
   1303  1.3  christos Gas giants like Jupiter are trickier still, as their polar and
   1304  1.3  christos equatorial regions rotate at different rates, so that the length of a
   1305  1.3  christos day depends on latitude.
   1306  1.3  christos This effect is most pronounced on Neptune, where the day is about 12
   1307  1.3  christos hours at the poles and 18 hours at the equator.
   1308  1.1  christos </p>
   1309  1.1  christos 
   1310  1.1  christos <p>
   1311  1.3  christos Although the <code><abbr>tz</abbr></code> database does not support
   1312  1.3  christos time on other planets, it is documented here in the hopes that support
   1313  1.3  christos will be added eventually.
   1314  1.1  christos </p>
   1315  1.1  christos 
   1316  1.1  christos <p>
   1317  1.3  christos Sources for time on other planets:
   1318  1.1  christos </p>
   1319  1.3  christos 
   1320  1.1  christos <ul>
   1321  1.1  christos   <li>
   1322  1.3  christos     Michael Allison and Robert Schmunk,
   1323  1.3  christos     "<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical
   1324  1.3  christos       Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>"
   1325  1.3  christos     (2015-06-30).
   1326  1.1  christos   </li>
   1327  1.1  christos   <li>
   1328  1.3  christos     Jia-Rui Chong,
   1329  1.3  christos     "<a href="http://articles.latimes.com/2004/jan/14/science/sci-marstime14">Workdays
   1330  1.3  christos     Fit for a Martian</a>", <cite>Los Angeles Times</cite>
   1331  1.3  christos     (2004-01-14), pp A1, A20&ndash;A21.
   1332  1.1  christos   </li>
   1333  1.1  christos   <li>
   1334  1.3  christos     Tom Chmielewski,
   1335  1.3  christos     "<a href="https://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/">Jet
   1336  1.3  christos     Lag Is Worse on Mars</a>", <cite>The Atlantic</cite> (2015-02-26)
   1337  1.1  christos   </li>
   1338  1.1  christos   <li>
   1339  1.3  christos     Matt Williams,
   1340  1.3  christos     "<a href="https://www.universetoday.com/37481/days-of-the-planets/">How
   1341  1.3  christos     long is a day on the other planets of the solar system?</a>"
   1342  1.4  christos     (2016-01-20).
   1343  1.1  christos   </li>
   1344  1.1  christos </ul>
   1345  1.3  christos </section>
   1346  1.1  christos 
   1347  1.3  christos <footer>
   1348  1.3  christos   <hr>
   1349  1.3  christos   This file is in the public domain, so clarified as of 2009-05-17 by
   1350  1.3  christos   Arthur David Olson.
   1351  1.3  christos </footer>
   1352  1.1  christos </body>
   1353  1.1  christos </html>
   1354