14616d0f9Sopenharmony_ci<!DOCTYPE html>
24616d0f9Sopenharmony_ci<html lang="en">
34616d0f9Sopenharmony_ci<head>
44616d0f9Sopenharmony_ci  <title>Theory and pragmatics of the tz code and data</title>
54616d0f9Sopenharmony_ci  <meta charset="UTF-8">
64616d0f9Sopenharmony_ci  <style>
74616d0f9Sopenharmony_ci    pre {margin-left: 2em; white-space: pre-wrap;}
84616d0f9Sopenharmony_ci  </style>
94616d0f9Sopenharmony_ci</head>
104616d0f9Sopenharmony_ci
114616d0f9Sopenharmony_ci<body>
124616d0f9Sopenharmony_ci<h1>Theory and pragmatics of the <code><abbr>tz</abbr></code> code and data</h1>
134616d0f9Sopenharmony_ci  <h3>Outline</h3>
144616d0f9Sopenharmony_ci  <nav>
154616d0f9Sopenharmony_ci    <ul>
164616d0f9Sopenharmony_ci      <li><a href="#scope">Scope of the <code><abbr>tz</abbr></code>
174616d0f9Sopenharmony_ci	  database</a></li>
184616d0f9Sopenharmony_ci      <li><a href="#naming">Timezone identifiers</a></li>
194616d0f9Sopenharmony_ci      <li><a href="#abbreviations">Time zone abbreviations</a></li>
204616d0f9Sopenharmony_ci      <li><a href="#accuracy">Accuracy of the <code><abbr>tz</abbr></code>
214616d0f9Sopenharmony_ci	  database</a></li>
224616d0f9Sopenharmony_ci      <li><a href="#functions">Time and date functions</a></li>
234616d0f9Sopenharmony_ci      <li><a href="#stability">Interface stability</a></li>
244616d0f9Sopenharmony_ci      <li><a href="#leapsec">Leap seconds</a></li>
254616d0f9Sopenharmony_ci      <li><a href="#calendar">Calendrical issues</a></li>
264616d0f9Sopenharmony_ci      <li><a href="#planets">Time and time zones off earth</a></li>
274616d0f9Sopenharmony_ci    </ul>
284616d0f9Sopenharmony_ci  </nav>
294616d0f9Sopenharmony_ci
304616d0f9Sopenharmony_ci<section>
314616d0f9Sopenharmony_ci  <h2 id="scope">Scope of the <code><abbr>tz</abbr></code> database</h2>
324616d0f9Sopenharmony_ci<p>
334616d0f9Sopenharmony_ciThe <a
344616d0f9Sopenharmony_cihref="https://www.iana.org/time-zones"><code><abbr>tz</abbr></code>
354616d0f9Sopenharmony_cidatabase</a> attempts to record the history and predicted future of
364616d0f9Sopenharmony_cicivil time scales.
374616d0f9Sopenharmony_ciIt organizes <a href="tz-link.html">time zone and daylight saving time
384616d0f9Sopenharmony_cidata</a> by partitioning the world into <a
394616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><dfn>timezones</dfn></a>
404616d0f9Sopenharmony_ciwhose clocks all agree about timestamps that occur after the <a
414616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/Unix_time">POSIX Epoch</a>
424616d0f9Sopenharmony_ci(1970-01-01 00:00:00 <a
434616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr
444616d0f9Sopenharmony_cititle="Coordinated Universal Time">UTC</abbr></a>).
454616d0f9Sopenharmony_ciAlthough 1970 is a somewhat-arbitrary cutoff, there are significant
464616d0f9Sopenharmony_cichallenges to moving the cutoff earlier even by a decade or two, due
474616d0f9Sopenharmony_cito the wide variety of local practices before computer timekeeping
484616d0f9Sopenharmony_cibecame prevalent.
494616d0f9Sopenharmony_ciMost timezones correspond to a notable location and the database
504616d0f9Sopenharmony_cirecords all known clock transitions for that location;
514616d0f9Sopenharmony_cisome timezones correspond instead to a fixed <abbr>UTC</abbr> offset.
524616d0f9Sopenharmony_ci</p>
534616d0f9Sopenharmony_ci
544616d0f9Sopenharmony_ci<p>
554616d0f9Sopenharmony_ciEach timezone typically corresponds to a geographical region that is
564616d0f9Sopenharmony_cismaller than a traditional time zone, because clocks in a timezone
574616d0f9Sopenharmony_ciall agree after 1970 whereas a traditional time zone merely
584616d0f9Sopenharmony_cispecifies current standard time. For example, applications that deal
594616d0f9Sopenharmony_ciwith current and future timestamps in the traditional North
604616d0f9Sopenharmony_ciAmerican mountain time zone can choose from the timezones
614616d0f9Sopenharmony_ci<code>America/Denver</code> which observes US-style daylight saving
624616d0f9Sopenharmony_citime (<abbr>DST</abbr>),
634616d0f9Sopenharmony_ciand <code>America/Phoenix</code> which does not observe <abbr>DST</abbr>.
644616d0f9Sopenharmony_ciApplications that also deal with past timestamps in the mountain time
654616d0f9Sopenharmony_cizone can choose from over a dozen timezones, such as
664616d0f9Sopenharmony_ci<code>America/Boise</code>, <code>America/Edmonton</code>, and
674616d0f9Sopenharmony_ci<code>America/Hermosillo</code>, each of which currently uses mountain
684616d0f9Sopenharmony_citime but differs from other timezones for some timestamps after 1970.
694616d0f9Sopenharmony_ci</p>
704616d0f9Sopenharmony_ci
714616d0f9Sopenharmony_ci<p>
724616d0f9Sopenharmony_ciClock transitions before 1970 are recorded for location-based timezones,
734616d0f9Sopenharmony_cibecause most systems support timestamps before 1970 and could
744616d0f9Sopenharmony_cimisbehave if data entries were omitted for pre-1970 transitions.
754616d0f9Sopenharmony_ciHowever, the database is not designed for and does not suffice for
764616d0f9Sopenharmony_ciapplications requiring accurate handling of all past times everywhere,
774616d0f9Sopenharmony_cias it would take far too much effort and guesswork to record all
784616d0f9Sopenharmony_cidetails of pre-1970 civil timekeeping.
794616d0f9Sopenharmony_ciAlthough some information outside the scope of the database is
804616d0f9Sopenharmony_cicollected in a file <code>backzone</code> that is distributed along
814616d0f9Sopenharmony_ciwith the database proper, this file is less reliable and does not
824616d0f9Sopenharmony_cinecessarily follow database guidelines.
834616d0f9Sopenharmony_ci</p>
844616d0f9Sopenharmony_ci
854616d0f9Sopenharmony_ci<p>
864616d0f9Sopenharmony_ciAs described below, reference source code for using the
874616d0f9Sopenharmony_ci<code><abbr>tz</abbr></code> database is also available.
884616d0f9Sopenharmony_ciThe <code><abbr>tz</abbr></code> code is upwards compatible with <a
894616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/POSIX">POSIX</a>, an international
904616d0f9Sopenharmony_cistandard for <a
914616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems.
924616d0f9Sopenharmony_ciAs of this writing, the current edition of POSIX is: <a
934616d0f9Sopenharmony_cihref="https://pubs.opengroup.org/onlinepubs/9699919799/"> The Open
944616d0f9Sopenharmony_ciGroup Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018
954616d0f9Sopenharmony_ciEdition.
964616d0f9Sopenharmony_ciBecause the database's scope encompasses real-world changes to civil
974616d0f9Sopenharmony_citimekeeping, its model for describing time is more complex than the
984616d0f9Sopenharmony_cistandard and daylight saving times supported by POSIX.1-2017.
994616d0f9Sopenharmony_ciA <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can
1004616d0f9Sopenharmony_cihave more than two changes per year, these changes need not merely
1014616d0f9Sopenharmony_ciflip back and forth between two alternatives, and the rules themselves
1024616d0f9Sopenharmony_cican change at times.
1034616d0f9Sopenharmony_ciWhether and when a timezone changes its clock,
1044616d0f9Sopenharmony_ciand even the timezone's notional base offset from <abbr>UTC</abbr>,
1054616d0f9Sopenharmony_ciare variable.
1064616d0f9Sopenharmony_ciIt does not always make sense to talk about a timezone's
1074616d0f9Sopenharmony_ci"base offset", which is not necessarily a single number.
1084616d0f9Sopenharmony_ci</p>
1094616d0f9Sopenharmony_ci
1104616d0f9Sopenharmony_ci</section>
1114616d0f9Sopenharmony_ci
1124616d0f9Sopenharmony_ci<section>
1134616d0f9Sopenharmony_ci  <h2 id="naming">Timezone identifiers</h2>
1144616d0f9Sopenharmony_ci<p>
1154616d0f9Sopenharmony_ciEach timezone has a name that uniquely identifies the timezone.
1164616d0f9Sopenharmony_ciInexperienced users are not expected to select these names unaided.
1174616d0f9Sopenharmony_ciDistributors should provide documentation and/or a simple selection
1184616d0f9Sopenharmony_ciinterface that explains each name via a map or via descriptive text like
1194616d0f9Sopenharmony_ci"Czech Republic" instead of the timezone name "<code>Europe/Prague</code>".
1204616d0f9Sopenharmony_ciIf geolocation information is available, a selection interface can
1214616d0f9Sopenharmony_cilocate the user on a timezone map or prioritize names that are
1224616d0f9Sopenharmony_cigeographically close. For an example selection interface, see the
1234616d0f9Sopenharmony_ci<code>tzselect</code> program in the <code><abbr>tz</abbr></code> code.
1244616d0f9Sopenharmony_ciThe <a href="https://cldr.unicode.org">Unicode Common Locale Data
1254616d0f9Sopenharmony_ciRepository</a> contains data that may be useful for other selection
1264616d0f9Sopenharmony_ciinterfaces; it maps timezone names like <code>Europe/Prague</code> to
1274616d0f9Sopenharmony_cilocale-dependent strings like "Prague", "Praha", "Прага", and "布拉格".
1284616d0f9Sopenharmony_ci</p>
1294616d0f9Sopenharmony_ci
1304616d0f9Sopenharmony_ci<p>
1314616d0f9Sopenharmony_ciThe naming conventions attempt to strike a balance
1324616d0f9Sopenharmony_ciamong the following goals:
1334616d0f9Sopenharmony_ci</p>
1344616d0f9Sopenharmony_ci
1354616d0f9Sopenharmony_ci<ul>
1364616d0f9Sopenharmony_ci  <li>
1374616d0f9Sopenharmony_ci    Uniquely identify every timezone where clocks have agreed since 1970.
1384616d0f9Sopenharmony_ci    This is essential for the intended use: static clocks keeping local
1394616d0f9Sopenharmony_ci    civil time.
1404616d0f9Sopenharmony_ci  </li>
1414616d0f9Sopenharmony_ci  <li>
1424616d0f9Sopenharmony_ci    Indicate to experts where the timezone's clocks typically are.
1434616d0f9Sopenharmony_ci  </li>
1444616d0f9Sopenharmony_ci  <li>
1454616d0f9Sopenharmony_ci    Be robust in the presence of political changes.
1464616d0f9Sopenharmony_ci    For example, names are typically not tied to countries, to avoid
1474616d0f9Sopenharmony_ci    incompatibilities when countries change their name (e.g.,
1484616d0f9Sopenharmony_ci    Swaziland&rarr;Eswatini) or when locations change countries (e.g., Hong
1494616d0f9Sopenharmony_ci    Kong from UK colony to China).
1504616d0f9Sopenharmony_ci    There is no requirement that every country or national
1514616d0f9Sopenharmony_ci    capital must have a timezone name.
1524616d0f9Sopenharmony_ci  </li>
1534616d0f9Sopenharmony_ci  <li>
1544616d0f9Sopenharmony_ci    Be portable to a wide variety of implementations.
1554616d0f9Sopenharmony_ci  </li>
1564616d0f9Sopenharmony_ci  <li>
1574616d0f9Sopenharmony_ci    Use a consistent naming conventions over the entire world.
1584616d0f9Sopenharmony_ci  </li>
1594616d0f9Sopenharmony_ci</ul>
1604616d0f9Sopenharmony_ci
1614616d0f9Sopenharmony_ci<p>
1624616d0f9Sopenharmony_ciNames normally have the form
1634616d0f9Sopenharmony_ci<var>AREA</var><code>/</code><var>LOCATION</var>, where
1644616d0f9Sopenharmony_ci<var>AREA</var> is a continent or ocean, and
1654616d0f9Sopenharmony_ci<var>LOCATION</var> is a specific location within the area.
1664616d0f9Sopenharmony_ciNorth and South America share the same area, '<code>America</code>'.
1674616d0f9Sopenharmony_ciTypical names are '<code>Africa/Cairo</code>',
1684616d0f9Sopenharmony_ci'<code>America/New_York</code>', and '<code>Pacific/Honolulu</code>'.
1694616d0f9Sopenharmony_ciSome names are further qualified to help avoid confusion; for example,
1704616d0f9Sopenharmony_ci'<code>America/Indiana/Petersburg</code>' distinguishes Petersburg,
1714616d0f9Sopenharmony_ciIndiana from other Petersburgs in America.
1724616d0f9Sopenharmony_ci</p>
1734616d0f9Sopenharmony_ci
1744616d0f9Sopenharmony_ci<p>
1754616d0f9Sopenharmony_ciHere are the general guidelines used for
1764616d0f9Sopenharmony_cichoosing timezone names,
1774616d0f9Sopenharmony_ciin decreasing order of importance:
1784616d0f9Sopenharmony_ci</p>
1794616d0f9Sopenharmony_ci
1804616d0f9Sopenharmony_ci<ul>
1814616d0f9Sopenharmony_ci  <li>
1824616d0f9Sopenharmony_ci    Use only valid POSIX file name components (i.e., the parts of
1834616d0f9Sopenharmony_ci    names other than '<code>/</code>').
1844616d0f9Sopenharmony_ci    Do not use the file name components '<code>.</code>' and
1854616d0f9Sopenharmony_ci    '<code>..</code>'.
1864616d0f9Sopenharmony_ci    Within a file name component, use only <a
1874616d0f9Sopenharmony_ci    href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters,
1884616d0f9Sopenharmony_ci    '<code>.</code>', '<code>-</code>' and '<code>_</code>'.
1894616d0f9Sopenharmony_ci    Do not use digits, as that might create an ambiguity with <a
1904616d0f9Sopenharmony_ci    href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX.1-2017
1914616d0f9Sopenharmony_ci    <code>TZ</code> strings</a>.
1924616d0f9Sopenharmony_ci    A file name component must not exceed 14 characters or start with
1934616d0f9Sopenharmony_ci    '<code>-</code>'.
1944616d0f9Sopenharmony_ci    E.g., prefer <code>America/Noronha</code> to
1954616d0f9Sopenharmony_ci    <code>America/Fernando_de_Noronha</code>.
1964616d0f9Sopenharmony_ci    Exceptions: see the discussion of legacy names below.
1974616d0f9Sopenharmony_ci  </li>
1984616d0f9Sopenharmony_ci  <li>
1994616d0f9Sopenharmony_ci    A name must not be empty, or contain '<code>//</code>', or
2004616d0f9Sopenharmony_ci    start or end with '<code>/</code>'.
2014616d0f9Sopenharmony_ci  </li>
2024616d0f9Sopenharmony_ci  <li>
2034616d0f9Sopenharmony_ci    Do not use names that differ only in case.
2044616d0f9Sopenharmony_ci    Although the reference implementation is case-sensitive, some
2054616d0f9Sopenharmony_ci    other implementations are not, and they would mishandle names
2064616d0f9Sopenharmony_ci    differing only in case.
2074616d0f9Sopenharmony_ci  </li>
2084616d0f9Sopenharmony_ci  <li>
2094616d0f9Sopenharmony_ci    If one name <var>A</var> is an initial prefix of another
2104616d0f9Sopenharmony_ci    name <var>AB</var> (ignoring case), then <var>B</var> must not
2114616d0f9Sopenharmony_ci    start with '<code>/</code>', as a regular file cannot have the
2124616d0f9Sopenharmony_ci    same name as a directory in POSIX.
2134616d0f9Sopenharmony_ci    For example, <code>America/New_York</code> precludes
2144616d0f9Sopenharmony_ci    <code>America/New_York/Bronx</code>.
2154616d0f9Sopenharmony_ci  </li>
2164616d0f9Sopenharmony_ci  <li>
2174616d0f9Sopenharmony_ci    Uninhabited regions like the North Pole and Bouvet Island
2184616d0f9Sopenharmony_ci    do not need locations, since local time is not defined there.
2194616d0f9Sopenharmony_ci  </li>
2204616d0f9Sopenharmony_ci  <li>
2214616d0f9Sopenharmony_ci    If all the clocks in a timezone have agreed since 1970,
2224616d0f9Sopenharmony_ci    do not bother to include more than one timezone
2234616d0f9Sopenharmony_ci    even if some of the clocks disagreed before 1970.
2244616d0f9Sopenharmony_ci    Otherwise these tables would become annoyingly large.
2254616d0f9Sopenharmony_ci  </li>
2264616d0f9Sopenharmony_ci  <li>
2274616d0f9Sopenharmony_ci    If boundaries between regions are fluid, such as during a war or
2284616d0f9Sopenharmony_ci    insurrection, do not bother to create a new timezone merely
2294616d0f9Sopenharmony_ci    because of yet another boundary change. This helps prevent table
2304616d0f9Sopenharmony_ci    bloat and simplifies maintenance.
2314616d0f9Sopenharmony_ci  </li>
2324616d0f9Sopenharmony_ci  <li>
2334616d0f9Sopenharmony_ci    If a name is ambiguous, use a less ambiguous alternative;
2344616d0f9Sopenharmony_ci    e.g., many cities are named San José and Georgetown, so
2354616d0f9Sopenharmony_ci    prefer <code>America/Costa_Rica</code> to
2364616d0f9Sopenharmony_ci    <code>America/San_Jose</code> and <code>America/Guyana</code>
2374616d0f9Sopenharmony_ci    to <code>America/Georgetown</code>.
2384616d0f9Sopenharmony_ci  </li>
2394616d0f9Sopenharmony_ci  <li>
2404616d0f9Sopenharmony_ci    Keep locations compact.
2414616d0f9Sopenharmony_ci    Use cities or small islands, not countries or regions, so that any
2424616d0f9Sopenharmony_ci    future changes do not split individual locations into different
2434616d0f9Sopenharmony_ci    timezones.
2444616d0f9Sopenharmony_ci    E.g., prefer <code>Europe/Paris</code> to <code>Europe/France</code>,
2454616d0f9Sopenharmony_ci    since
2464616d0f9Sopenharmony_ci    <a href="https://en.wikipedia.org/wiki/Time_in_France#History">France
2474616d0f9Sopenharmony_ci    has had multiple time zones</a>.
2484616d0f9Sopenharmony_ci  </li>
2494616d0f9Sopenharmony_ci  <li>
2504616d0f9Sopenharmony_ci    Use mainstream English spelling, e.g., prefer
2514616d0f9Sopenharmony_ci    <code>Europe/Rome</code> to <code>Europa/Roma</code>, and
2524616d0f9Sopenharmony_ci    prefer <code>Europe/Athens</code> to the Greek
2534616d0f9Sopenharmony_ci    <code>Ευρώπη/Αθήνα</code> or the Romanized
2544616d0f9Sopenharmony_ci    <code>Evrópi/Athína</code>.
2554616d0f9Sopenharmony_ci    The POSIX file name restrictions encourage this guideline.
2564616d0f9Sopenharmony_ci  </li>
2574616d0f9Sopenharmony_ci  <li>
2584616d0f9Sopenharmony_ci    Use the most populous among locations in a region,
2594616d0f9Sopenharmony_ci    e.g., prefer <code>Asia/Shanghai</code> to
2604616d0f9Sopenharmony_ci    <code>Asia/Beijing</code>.
2614616d0f9Sopenharmony_ci    Among locations with similar populations, pick the best-known
2624616d0f9Sopenharmony_ci    location, e.g., prefer <code>Europe/Rome</code> to
2634616d0f9Sopenharmony_ci    <code>Europe/Milan</code>.
2644616d0f9Sopenharmony_ci  </li>
2654616d0f9Sopenharmony_ci  <li>
2664616d0f9Sopenharmony_ci    Use the singular form, e.g., prefer <code>Atlantic/Canary</code> to
2674616d0f9Sopenharmony_ci    <code>Atlantic/Canaries</code>.
2684616d0f9Sopenharmony_ci  </li>
2694616d0f9Sopenharmony_ci  <li>
2704616d0f9Sopenharmony_ci    Omit common suffixes like '<code>_Islands</code>' and
2714616d0f9Sopenharmony_ci    '<code>_City</code>', unless that would lead to ambiguity.
2724616d0f9Sopenharmony_ci    E.g., prefer <code>America/Cayman</code> to
2734616d0f9Sopenharmony_ci    <code>America/Cayman_Islands</code> and
2744616d0f9Sopenharmony_ci    <code>America/Guatemala</code> to
2754616d0f9Sopenharmony_ci    <code>America/Guatemala_City</code>, but prefer
2764616d0f9Sopenharmony_ci    <code>America/Mexico_City</code> to
2774616d0f9Sopenharmony_ci    <code>America/Mexico</code>
2784616d0f9Sopenharmony_ci    because <a href="https://en.wikipedia.org/wiki/Time_in_Mexico">the
2794616d0f9Sopenharmony_ci    country of Mexico has several time zones</a>.
2804616d0f9Sopenharmony_ci  </li>
2814616d0f9Sopenharmony_ci  <li>
2824616d0f9Sopenharmony_ci    Use '<code>_</code>' to represent a space.
2834616d0f9Sopenharmony_ci  </li>
2844616d0f9Sopenharmony_ci  <li>
2854616d0f9Sopenharmony_ci    Omit '<code>.</code>' from abbreviations in names.
2864616d0f9Sopenharmony_ci    E.g., prefer <code>Atlantic/St_Helena</code> to
2874616d0f9Sopenharmony_ci    <code>Atlantic/St._Helena</code>.
2884616d0f9Sopenharmony_ci  </li>
2894616d0f9Sopenharmony_ci  <li>
2904616d0f9Sopenharmony_ci    Do not change established names if they only marginally violate
2914616d0f9Sopenharmony_ci    the above guidelines.
2924616d0f9Sopenharmony_ci    For example, do not change the existing name <code>Europe/Rome</code> to
2934616d0f9Sopenharmony_ci    <code>Europe/Milan</code> merely because Milan's population has grown
2944616d0f9Sopenharmony_ci    to be somewhat greater than Rome's.
2954616d0f9Sopenharmony_ci  </li>
2964616d0f9Sopenharmony_ci  <li>
2974616d0f9Sopenharmony_ci    If a name is changed, put its old spelling in the
2984616d0f9Sopenharmony_ci    '<code>backward</code>' file as a link to the new spelling.
2994616d0f9Sopenharmony_ci    This means old spellings will continue to work.
3004616d0f9Sopenharmony_ci    Ordinarily a name change should occur only in the rare case when
3014616d0f9Sopenharmony_ci    a location's consensus English-language spelling changes; for example,
3024616d0f9Sopenharmony_ci    in 2008 <code>Asia/Calcutta</code> was renamed to <code>Asia/Kolkata</code>
3034616d0f9Sopenharmony_ci    due to long-time widespread use of the new city name instead of the old.
3044616d0f9Sopenharmony_ci  </li>
3054616d0f9Sopenharmony_ci</ul>
3064616d0f9Sopenharmony_ci
3074616d0f9Sopenharmony_ci<p>
3084616d0f9Sopenharmony_ciGuidelines have evolved with time, and names following old versions of
3094616d0f9Sopenharmony_cithese guidelines might not follow the current version. When guidelines
3104616d0f9Sopenharmony_cihave changed, old names continue to be supported. Guideline changes
3114616d0f9Sopenharmony_cihave included the following:
3124616d0f9Sopenharmony_ci</p>
3134616d0f9Sopenharmony_ci
3144616d0f9Sopenharmony_ci<ul>
3154616d0f9Sopenharmony_ci<li>
3164616d0f9Sopenharmony_ciOlder versions of this package used a different naming scheme.
3174616d0f9Sopenharmony_ciSee the file '<code>backward</code>' for most of these older names
3184616d0f9Sopenharmony_ci(e.g., '<code>US/Eastern</code>' instead of '<code>America/New_York</code>').
3194616d0f9Sopenharmony_ciThe other old-fashioned names still supported are
3204616d0f9Sopenharmony_ci'<code>WET</code>', '<code>CET</code>', '<code>MET</code>', and
3214616d0f9Sopenharmony_ci'<code>EET</code>' (see the file '<code>europe</code>').
3224616d0f9Sopenharmony_ci</li>
3234616d0f9Sopenharmony_ci
3244616d0f9Sopenharmony_ci<li>
3254616d0f9Sopenharmony_ciOlder versions of this package defined legacy names that are
3264616d0f9Sopenharmony_ciincompatible with the first guideline of location names, but which are
3274616d0f9Sopenharmony_cistill supported.
3284616d0f9Sopenharmony_ciThese legacy names are mostly defined in the file
3294616d0f9Sopenharmony_ci'<code>etcetera</code>'.
3304616d0f9Sopenharmony_ciAlso, the file '<code>backward</code>' defines the legacy names
3314616d0f9Sopenharmony_ci'<code>Etc/GMT0</code>', '<code>Etc/GMT-0</code>', '<code>Etc/GMT+0</code>',
3324616d0f9Sopenharmony_ci'<code>GMT0</code>', '<code>GMT-0</code>' and '<code>GMT+0</code>',
3334616d0f9Sopenharmony_ciand the file '<code>northamerica</code>' defines the legacy names
3344616d0f9Sopenharmony_ci'<code>EST5EDT</code>', '<code>CST6CDT</code>',
3354616d0f9Sopenharmony_ci'<code>MST7MDT</code>', and '<code>PST8PDT</code>'.
3364616d0f9Sopenharmony_ci</li>
3374616d0f9Sopenharmony_ci
3384616d0f9Sopenharmony_ci<li>
3394616d0f9Sopenharmony_ciOlder versions of these guidelines said that
3404616d0f9Sopenharmony_cithere should typically be at least one name for each <a
3414616d0f9Sopenharmony_cihref="https://en.wikipedia.org/wiki/ISO_3166-1"><abbr
3424616d0f9Sopenharmony_cititle="International Organization for Standardization">ISO</abbr>
3434616d0f9Sopenharmony_ci3166-1</a> officially assigned two-letter code for an inhabited
3444616d0f9Sopenharmony_cicountry or territory.
3454616d0f9Sopenharmony_ciThis old guideline has been dropped, as it was not needed to handle
3464616d0f9Sopenharmony_citimestamps correctly and it increased maintenance burden.
3474616d0f9Sopenharmony_ci</li>
3484616d0f9Sopenharmony_ci</ul>
3494616d0f9Sopenharmony_ci
3504616d0f9Sopenharmony_ci<p>
3514616d0f9Sopenharmony_ciThe file <code>zone1970.tab</code> lists geographical locations used
3524616d0f9Sopenharmony_cito name timezones.
3534616d0f9Sopenharmony_ciIt is intended to be an exhaustive list of names for geographic
3544616d0f9Sopenharmony_ciregions as described above; this is a subset of the timezones in the data.
3554616d0f9Sopenharmony_ciAlthough a <code>zone1970.tab</code> location's
3564616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
3574616d0f9Sopenharmony_cicorresponds to
3584616d0f9Sopenharmony_ciits <a href="https://en.wikipedia.org/wiki/Local_mean_time">local mean
3594616d0f9Sopenharmony_citime (<abbr>LMT</abbr>)</a> offset with one hour for every 15&deg;
3604616d0f9Sopenharmony_cieast longitude, this relationship is not exact.
3614616d0f9Sopenharmony_ciThe backward-compatibility file <code>zone.tab</code> is similar
3624616d0f9Sopenharmony_cibut conforms to the older-version guidelines related to <abbr>ISO</abbr> 3166-1;
3634616d0f9Sopenharmony_ciit lists only one country code per entry and unlike <code>zone1970.tab</code>
3644616d0f9Sopenharmony_ciit can list names defined in <code>backward</code>.
3654616d0f9Sopenharmony_ciApplications that process only timestamps from now on can instead use the file
3664616d0f9Sopenharmony_ci<code>zonenow.tab</code>, which partitions the world more coarsely,
3674616d0f9Sopenharmony_ciinto regions where clocks agree now and in the predicted future;
3684616d0f9Sopenharmony_cithis file is smaller and simpler than <code>zone1970.tab</code>
3694616d0f9Sopenharmony_ciand <code>zone.tab</code>.
3704616d0f9Sopenharmony_ci</p>
3714616d0f9Sopenharmony_ci
3724616d0f9Sopenharmony_ci<p>
3734616d0f9Sopenharmony_ciThe database defines each timezone name to be a zone, or a link to a zone.
3744616d0f9Sopenharmony_ciThe source file <code>backward</code> defines links for backward
3754616d0f9Sopenharmony_cicompatibility; it does not define zones.
3764616d0f9Sopenharmony_ciAlthough <code>backward</code> was originally designed to be optional,
3774616d0f9Sopenharmony_cinowadays distributions typically use it
3784616d0f9Sopenharmony_ciand no great weight should be attached to whether a link
3794616d0f9Sopenharmony_ciis defined in <code>backward</code> or in some other file.
3804616d0f9Sopenharmony_ciThe source file <code>etcetera</code> defines names that may be useful
3814616d0f9Sopenharmony_cion platforms that do not support POSIX.1-2017-style <code>TZ</code> strings;
3824616d0f9Sopenharmony_cino other source file other than <code>backward</code>
3834616d0f9Sopenharmony_cicontains links to its zones.
3844616d0f9Sopenharmony_ciOne of <code>etcetera</code>'s names is <code>Etc/UTC</code>,
3854616d0f9Sopenharmony_ciused by functions like <code>gmtime</code> to obtain leap
3864616d0f9Sopenharmony_cisecond information on platforms that support leap seconds.
3874616d0f9Sopenharmony_ciAnother <code>etcetera</code> name, <code>GMT</code>,
3884616d0f9Sopenharmony_ciis used by older code releases.
3894616d0f9Sopenharmony_ci</p>
3904616d0f9Sopenharmony_ci</section>
3914616d0f9Sopenharmony_ci
3924616d0f9Sopenharmony_ci<section>
3934616d0f9Sopenharmony_ci  <h2 id="abbreviations">Time zone abbreviations</h2>
3944616d0f9Sopenharmony_ci<p>
3954616d0f9Sopenharmony_ciWhen this package is installed, it generates time zone abbreviations
3964616d0f9Sopenharmony_cilike '<code>EST</code>' to be compatible with human tradition and POSIX.
3974616d0f9Sopenharmony_ciHere are the general guidelines used for choosing time zone abbreviations,
3984616d0f9Sopenharmony_ciin decreasing order of importance:
3994616d0f9Sopenharmony_ci</p>
4004616d0f9Sopenharmony_ci
4014616d0f9Sopenharmony_ci<ul>
4024616d0f9Sopenharmony_ci  <li>
4034616d0f9Sopenharmony_ci    Use three to six characters that are ASCII alphanumerics or
4044616d0f9Sopenharmony_ci    '<code>+</code>' or '<code>-</code>'.
4054616d0f9Sopenharmony_ci    Previous editions of this database also used characters like
4064616d0f9Sopenharmony_ci    space and '<code>?</code>', but these characters have a
4074616d0f9Sopenharmony_ci    special meaning to the
4084616d0f9Sopenharmony_ci    <a href="https://en.wikipedia.org/wiki/Unix_shell">UNIX shell</a>
4094616d0f9Sopenharmony_ci    and cause commands like
4104616d0f9Sopenharmony_ci    '<code><a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set">set</a>
4114616d0f9Sopenharmony_ci    `<a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html">date</a>`</code>'
4124616d0f9Sopenharmony_ci    to have unexpected effects.
4134616d0f9Sopenharmony_ci    Previous editions of this guideline required upper-case letters, but the
4144616d0f9Sopenharmony_ci    Congressman who introduced
4154616d0f9Sopenharmony_ci    <a href="https://en.wikipedia.org/wiki/Chamorro_Time_Zone">Chamorro
4164616d0f9Sopenharmony_ci    Standard Time</a> preferred "ChST", so lower-case letters are now
4174616d0f9Sopenharmony_ci    allowed.
4184616d0f9Sopenharmony_ci    Also, POSIX from 2001 on relaxed the rule to allow '<code>-</code>',
4194616d0f9Sopenharmony_ci    '<code>+</code>', and alphanumeric characters from the portable
4204616d0f9Sopenharmony_ci    character set in the current locale.
4214616d0f9Sopenharmony_ci    In practice ASCII alphanumerics and '<code>+</code>' and
4224616d0f9Sopenharmony_ci    '<code>-</code>' are safe in all locales.
4234616d0f9Sopenharmony_ci
4244616d0f9Sopenharmony_ci    <p>
4254616d0f9Sopenharmony_ci    In other words, in the C locale the POSIX extended regular
4264616d0f9Sopenharmony_ci    expression <code>[-+[:alnum:]]{3,6}</code> should match the
4274616d0f9Sopenharmony_ci    abbreviation.
4284616d0f9Sopenharmony_ci    This guarantees that all abbreviations could have been specified by a
4294616d0f9Sopenharmony_ci    POSIX.1-2017 <code>TZ</code> string.
4304616d0f9Sopenharmony_ci    </p>
4314616d0f9Sopenharmony_ci  </li>
4324616d0f9Sopenharmony_ci  <li>
4334616d0f9Sopenharmony_ci    Use abbreviations that are in common use among English-speakers,
4344616d0f9Sopenharmony_ci    e.g., 'EST' for Eastern Standard Time in North America.
4354616d0f9Sopenharmony_ci    We assume that applications translate them to other languages
4364616d0f9Sopenharmony_ci    as part of the normal localization process; for example,
4374616d0f9Sopenharmony_ci    a French application might translate 'EST' to 'HNE'.
4384616d0f9Sopenharmony_ci
4394616d0f9Sopenharmony_ci    <p>
4404616d0f9Sopenharmony_ci    <small>These abbreviations (for standard/daylight/etc. time) are:
4414616d0f9Sopenharmony_ci      ACST/ACDT Australian Central,
4424616d0f9Sopenharmony_ci      AST/ADT/APT/AWT/ADDT Atlantic,
4434616d0f9Sopenharmony_ci      AEST/AEDT Australian Eastern,
4444616d0f9Sopenharmony_ci      AHST/AHDT Alaska-Hawaii,
4454616d0f9Sopenharmony_ci      AKST/AKDT Alaska,
4464616d0f9Sopenharmony_ci      AWST/AWDT Australian Western,
4474616d0f9Sopenharmony_ci      BST/BDT Bering,
4484616d0f9Sopenharmony_ci      CAT/CAST Central Africa,
4494616d0f9Sopenharmony_ci      CET/CEST/CEMT Central European,
4504616d0f9Sopenharmony_ci      ChST Chamorro,
4514616d0f9Sopenharmony_ci      CST/CDT/CWT/CPT Central [North America],
4524616d0f9Sopenharmony_ci      CST/CDT China,
4534616d0f9Sopenharmony_ci      GMT/BST/IST/BDST Greenwich,
4544616d0f9Sopenharmony_ci      EAT East Africa,
4554616d0f9Sopenharmony_ci      EST/EDT/EWT/EPT Eastern [North America],
4564616d0f9Sopenharmony_ci      EET/EEST Eastern European,
4574616d0f9Sopenharmony_ci      GST/GDT Guam,
4584616d0f9Sopenharmony_ci      HST/HDT/HWT/HPT Hawaii,
4594616d0f9Sopenharmony_ci      HKT/HKST/HKWT Hong Kong,
4604616d0f9Sopenharmony_ci      IST India,
4614616d0f9Sopenharmony_ci      IST/GMT Irish,
4624616d0f9Sopenharmony_ci      IST/IDT/IDDT Israel,
4634616d0f9Sopenharmony_ci      JST/JDT Japan,
4644616d0f9Sopenharmony_ci      KST/KDT Korea,
4654616d0f9Sopenharmony_ci      MET/MEST Middle European (a backward-compatibility alias for
4664616d0f9Sopenharmony_ci	Central European),
4674616d0f9Sopenharmony_ci      MSK/MSD Moscow,
4684616d0f9Sopenharmony_ci      MST/MDT/MWT/MPT Mountain,
4694616d0f9Sopenharmony_ci      NST/NDT/NWT/NPT/NDDT Newfoundland,
4704616d0f9Sopenharmony_ci      NST/NDT/NWT/NPT Nome,
4714616d0f9Sopenharmony_ci      NZMT/NZST New Zealand through 1945,
4724616d0f9Sopenharmony_ci      NZST/NZDT New Zealand 1946&ndash;present,
4734616d0f9Sopenharmony_ci      PKT/PKST Pakistan,
4744616d0f9Sopenharmony_ci      PST/PDT/PWT/PPT Pacific,
4754616d0f9Sopenharmony_ci      PST/PDT Philippine,
4764616d0f9Sopenharmony_ci      SAST South Africa,
4774616d0f9Sopenharmony_ci      SST Samoa,
4784616d0f9Sopenharmony_ci      UTC Universal,
4794616d0f9Sopenharmony_ci      WAT/WAST West Africa,
4804616d0f9Sopenharmony_ci      WET/WEST/WEMT Western European,
4814616d0f9Sopenharmony_ci      WIB Waktu Indonesia Barat,
4824616d0f9Sopenharmony_ci      WIT Waktu Indonesia Timur,
4834616d0f9Sopenharmony_ci      WITA Waktu Indonesia Tengah,
4844616d0f9Sopenharmony_ci      YST/YDT/YWT/YPT/YDDT Yukon</small>.
4854616d0f9Sopenharmony_ci    </p>
4864616d0f9Sopenharmony_ci  </li>
4874616d0f9Sopenharmony_ci  <li>
4884616d0f9Sopenharmony_ci    <p>
4894616d0f9Sopenharmony_ci    For times taken from a city's longitude, use the
4904616d0f9Sopenharmony_ci    traditional <var>x</var>MT notation.
4914616d0f9Sopenharmony_ci    The only abbreviation like this in current use is '<abbr>GMT</abbr>'.
4924616d0f9Sopenharmony_ci    The others are for timestamps before 1960,
4934616d0f9Sopenharmony_ci    except that Monrovia Mean Time persisted until 1972.
4944616d0f9Sopenharmony_ci    Typically, numeric abbreviations (e.g., '<code>-</code>004430' for
4954616d0f9Sopenharmony_ci    MMT) would cause trouble here, as the numeric strings would exceed
4964616d0f9Sopenharmony_ci    the POSIX length limit.
4974616d0f9Sopenharmony_ci    </p>
4984616d0f9Sopenharmony_ci
4994616d0f9Sopenharmony_ci    <p>
5004616d0f9Sopenharmony_ci    <small>These abbreviations are:
5014616d0f9Sopenharmony_ci      AMT Asunción, Athens;
5024616d0f9Sopenharmony_ci      BMT Baghdad, Bangkok, Batavia, Bermuda, Bern, Bogotá,
5034616d0f9Sopenharmony_ci        Brussels, Bucharest;
5044616d0f9Sopenharmony_ci      CMT Calamarca, Caracas, Chisinau, Colón, Córdoba;
5054616d0f9Sopenharmony_ci      DMT Dublin/Dunsink;
5064616d0f9Sopenharmony_ci      EMT Easter;
5074616d0f9Sopenharmony_ci      FFMT Fort-de-France;
5084616d0f9Sopenharmony_ci      FMT Funchal;
5094616d0f9Sopenharmony_ci      GMT Greenwich;
5104616d0f9Sopenharmony_ci      HMT Havana, Helsinki, Horta, Howrah;
5114616d0f9Sopenharmony_ci      IMT Irkutsk, Istanbul;
5124616d0f9Sopenharmony_ci      JMT Jerusalem;
5134616d0f9Sopenharmony_ci      KMT Kaunas, Kyiv, Kingston;
5144616d0f9Sopenharmony_ci      LMT Lima, Lisbon, local;
5154616d0f9Sopenharmony_ci      MMT Macassar, Madras, Malé, Managua, Minsk, Monrovia, Montevideo,
5164616d0f9Sopenharmony_ci	Moratuwa, Moscow;
5174616d0f9Sopenharmony_ci      PLMT Phù Liễn;
5184616d0f9Sopenharmony_ci      PMT Paramaribo, Paris, Perm, Pontianak, Prague;
5194616d0f9Sopenharmony_ci      PMMT Port Moresby;
5204616d0f9Sopenharmony_ci      PPMT Port-au-Prince;
5214616d0f9Sopenharmony_ci      QMT Quito;
5224616d0f9Sopenharmony_ci      RMT Rangoon, Riga, Rome;
5234616d0f9Sopenharmony_ci      SDMT Santo Domingo;
5244616d0f9Sopenharmony_ci      SJMT San José;
5254616d0f9Sopenharmony_ci      SMT Santiago, Simferopol, Singapore, Stanley;
5264616d0f9Sopenharmony_ci      TBMT Tbilisi;
5274616d0f9Sopenharmony_ci      TMT Tallinn, Tehran;
5284616d0f9Sopenharmony_ci      WMT Warsaw.</small>
5294616d0f9Sopenharmony_ci    </p>
5304616d0f9Sopenharmony_ci
5314616d0f9Sopenharmony_ci    <p>
5324616d0f9Sopenharmony_ci    <small>A few abbreviations also follow the pattern that
5334616d0f9Sopenharmony_ci    <abbr>GMT</abbr>/<abbr>BST</abbr> established for time in the UK.
5344616d0f9Sopenharmony_ci    They are:
5354616d0f9Sopenharmony_ci      BMT/BST for Bermuda 1890&ndash;1930,
5364616d0f9Sopenharmony_ci      CMT/BST for Calamarca Mean Time and Bolivian Summer Time
5374616d0f9Sopenharmony_ci	1890&ndash;1932,
5384616d0f9Sopenharmony_ci      DMT/IST for Dublin/Dunsink Mean Time and Irish Summer Time
5394616d0f9Sopenharmony_ci	1880&ndash;1916,
5404616d0f9Sopenharmony_ci      MMT/MST/MDST for Moscow 1880&ndash;1919, and
5414616d0f9Sopenharmony_ci      RMT/LST for Riga Mean Time and Latvian Summer time 1880&ndash;1926.
5424616d0f9Sopenharmony_ci    </small>
5434616d0f9Sopenharmony_ci    </p>
5444616d0f9Sopenharmony_ci  </li>
5454616d0f9Sopenharmony_ci  <li>
5464616d0f9Sopenharmony_ci    Use '<abbr>LMT</abbr>' for local mean time of locations before the
5474616d0f9Sopenharmony_ci    introduction of standard time; see "<a href="#scope">Scope of the
5484616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code> database</a>".
5494616d0f9Sopenharmony_ci  </li>
5504616d0f9Sopenharmony_ci  <li>
5514616d0f9Sopenharmony_ci    If there is no common English abbreviation, use numeric offsets like
5524616d0f9Sopenharmony_ci    <code>-</code>05 and <code>+</code>0530 that are generated
5534616d0f9Sopenharmony_ci    by <code>zic</code>'s <code>%z</code> notation.
5544616d0f9Sopenharmony_ci  </li>
5554616d0f9Sopenharmony_ci  <li>
5564616d0f9Sopenharmony_ci    Use current abbreviations for older timestamps to avoid confusion.
5574616d0f9Sopenharmony_ci    For example, in 1910 a common English abbreviation for time
5584616d0f9Sopenharmony_ci    in central Europe was 'MEZ' (short for both "Middle European
5594616d0f9Sopenharmony_ci    Zone" and for "Mitteleuropäische Zeit" in German).
5604616d0f9Sopenharmony_ci    Nowadays 'CET' ("Central European Time") is more common in
5614616d0f9Sopenharmony_ci    English, and the database uses 'CET' even for circa-1910
5624616d0f9Sopenharmony_ci    timestamps as this is less confusing for modern users and avoids
5634616d0f9Sopenharmony_ci    the need for determining when 'CET' supplanted 'MEZ' in common
5644616d0f9Sopenharmony_ci    usage.
5654616d0f9Sopenharmony_ci  </li>
5664616d0f9Sopenharmony_ci  <li>
5674616d0f9Sopenharmony_ci    Use a consistent style in a timezone's history.
5684616d0f9Sopenharmony_ci    For example, if a history tends to use numeric
5694616d0f9Sopenharmony_ci    abbreviations and a particular entry could go either way, use a
5704616d0f9Sopenharmony_ci    numeric abbreviation.
5714616d0f9Sopenharmony_ci  </li>
5724616d0f9Sopenharmony_ci  <li>
5734616d0f9Sopenharmony_ci    Use
5744616d0f9Sopenharmony_ci    <a href="https://en.wikipedia.org/wiki/Universal_Time">Universal Time</a>
5754616d0f9Sopenharmony_ci    (<abbr>UT</abbr>) (with time zone abbreviation '<code>-</code>00') for
5764616d0f9Sopenharmony_ci    locations while uninhabited.
5774616d0f9Sopenharmony_ci    The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in
5784616d0f9Sopenharmony_ci    some sense undefined; this notation is derived
5794616d0f9Sopenharmony_ci    from <a href="https://datatracker.ietf.org/doc/html/rfc3339">Internet
5804616d0f9Sopenharmony_ci    <abbr title="Request For Comments">RFC</abbr> 3339</a>.
5814616d0f9Sopenharmony_ci  </li>
5824616d0f9Sopenharmony_ci</ul>
5834616d0f9Sopenharmony_ci
5844616d0f9Sopenharmony_ci<p>
5854616d0f9Sopenharmony_ciApplication writers should note that these abbreviations are ambiguous
5864616d0f9Sopenharmony_ciin practice: e.g., 'CST' means one thing in China and something else
5874616d0f9Sopenharmony_ciin North America, and 'IST' can refer to time in India, Ireland or
5884616d0f9Sopenharmony_ciIsrael.
5894616d0f9Sopenharmony_ciTo avoid ambiguity, use numeric <abbr>UT</abbr> offsets like
5904616d0f9Sopenharmony_ci'<code>-</code>0600' instead of time zone abbreviations like 'CST'.
5914616d0f9Sopenharmony_ci</p>
5924616d0f9Sopenharmony_ci</section>
5934616d0f9Sopenharmony_ci
5944616d0f9Sopenharmony_ci<section>
5954616d0f9Sopenharmony_ci  <h2 id="accuracy">Accuracy of the <code><abbr>tz</abbr></code> database</h2>
5964616d0f9Sopenharmony_ci<p>
5974616d0f9Sopenharmony_ciThe <code><abbr>tz</abbr></code> database is not authoritative, and it
5984616d0f9Sopenharmony_cisurely has errors.
5994616d0f9Sopenharmony_ciCorrections are welcome and encouraged; see the file <code>CONTRIBUTING</code>.
6004616d0f9Sopenharmony_ciUsers requiring authoritative data should consult national standards
6014616d0f9Sopenharmony_cibodies and the references cited in the database's comments.
6024616d0f9Sopenharmony_ci</p>
6034616d0f9Sopenharmony_ci
6044616d0f9Sopenharmony_ci<p>
6054616d0f9Sopenharmony_ciErrors in the <code><abbr>tz</abbr></code> database arise from many sources:
6064616d0f9Sopenharmony_ci</p>
6074616d0f9Sopenharmony_ci
6084616d0f9Sopenharmony_ci<ul>
6094616d0f9Sopenharmony_ci  <li>
6104616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database predicts future
6114616d0f9Sopenharmony_ci    timestamps, and current predictions
6124616d0f9Sopenharmony_ci    will be incorrect after future governments change the rules.
6134616d0f9Sopenharmony_ci    For example, if today someone schedules a meeting for 13:00 next
6144616d0f9Sopenharmony_ci    October 1, Casablanca time, and tomorrow Morocco changes its
6154616d0f9Sopenharmony_ci    daylight saving rules, software can mess up after the rule change
6164616d0f9Sopenharmony_ci    if it blithely relies on conversions made before the change.
6174616d0f9Sopenharmony_ci  </li>
6184616d0f9Sopenharmony_ci  <li>
6194616d0f9Sopenharmony_ci    The pre-1970 entries in this database cover only a tiny sliver of how
6204616d0f9Sopenharmony_ci    clocks actually behaved; the vast majority of the necessary
6214616d0f9Sopenharmony_ci    information was lost or never recorded.
6224616d0f9Sopenharmony_ci    Thousands more timezones would be needed if
6234616d0f9Sopenharmony_ci    the <code><abbr>tz</abbr></code> database's scope were extended to
6244616d0f9Sopenharmony_ci    cover even just the known or guessed history of standard time; for
6254616d0f9Sopenharmony_ci    example, the current single entry for France would need to split
6264616d0f9Sopenharmony_ci    into dozens of entries, perhaps hundreds.
6274616d0f9Sopenharmony_ci    And in most of the world even this approach would be misleading
6284616d0f9Sopenharmony_ci    due to widespread disagreement or indifference about what times
6294616d0f9Sopenharmony_ci    should be observed.
6304616d0f9Sopenharmony_ci    In her 2015 book
6314616d0f9Sopenharmony_ci    <cite><a
6324616d0f9Sopenharmony_ci    href="https://www.hup.harvard.edu/catalog.php?isbn=9780674286146">The
6334616d0f9Sopenharmony_ci    Global Transformation of Time, 1870&ndash;1950</a></cite>,
6344616d0f9Sopenharmony_ci    Vanessa Ogle writes
6354616d0f9Sopenharmony_ci    "Outside of Europe and North America there was no system of time
6364616d0f9Sopenharmony_ci    zones at all, often not even a stable landscape of mean times,
6374616d0f9Sopenharmony_ci    prior to the middle decades of the twentieth century".
6384616d0f9Sopenharmony_ci    See: Timothy Shenk, <a
6394616d0f9Sopenharmony_cihref="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanessa-ogle">Booked:
6404616d0f9Sopenharmony_ci      A Global History of Time</a>. <cite>Dissent</cite> 2015-12-17.
6414616d0f9Sopenharmony_ci  </li>
6424616d0f9Sopenharmony_ci  <li>
6434616d0f9Sopenharmony_ci    Most of the pre-1970 data entries come from unreliable sources, often
6444616d0f9Sopenharmony_ci    astrology books that lack citations and whose compilers evidently
6454616d0f9Sopenharmony_ci    invented entries when the true facts were unknown, without
6464616d0f9Sopenharmony_ci    reporting which entries were known and which were invented.
6474616d0f9Sopenharmony_ci    These books often contradict each other or give implausible entries,
6484616d0f9Sopenharmony_ci    and on the rare occasions when they are checked they are
6494616d0f9Sopenharmony_ci    typically found to be incorrect.
6504616d0f9Sopenharmony_ci  </li>
6514616d0f9Sopenharmony_ci  <li>
6524616d0f9Sopenharmony_ci    For the UK the <code><abbr>tz</abbr></code> database relies on
6534616d0f9Sopenharmony_ci    years of first-class work done by
6544616d0f9Sopenharmony_ci    Joseph Myers and others; see
6554616d0f9Sopenharmony_ci    "<a href="https://www.polyomino.org.uk/british-time/">History of
6564616d0f9Sopenharmony_ci    legal time in Britain</a>".
6574616d0f9Sopenharmony_ci    Other countries are not done nearly as well.
6584616d0f9Sopenharmony_ci  </li>
6594616d0f9Sopenharmony_ci  <li>
6604616d0f9Sopenharmony_ci    Sometimes, different people in the same city maintain clocks
6614616d0f9Sopenharmony_ci    that differ significantly.
6624616d0f9Sopenharmony_ci    Historically, railway time was used by railroad companies (which
6634616d0f9Sopenharmony_ci    did not always
6644616d0f9Sopenharmony_ci    agree with each other), church-clock time was used for birth
6654616d0f9Sopenharmony_ci    certificates, etc.
6664616d0f9Sopenharmony_ci    More recently, competing political groups might disagree about
6674616d0f9Sopenharmony_ci    clock settings. Often this is merely common practice, but
6684616d0f9Sopenharmony_ci    sometimes it is set by law.
6694616d0f9Sopenharmony_ci    For example, from 1891 to 1911 the <abbr>UT</abbr> offset in France
6704616d0f9Sopenharmony_ci    was legally <abbr>UT</abbr> +00:09:21 outside train stations and
6714616d0f9Sopenharmony_ci    <abbr>UT</abbr> +00:04:21 inside. Other examples include
6724616d0f9Sopenharmony_ci    Chillicothe in 1920, Palm Springs in 1946/7, and Jerusalem and
6734616d0f9Sopenharmony_ci    Ürümqi to this day.
6744616d0f9Sopenharmony_ci  </li>
6754616d0f9Sopenharmony_ci  <li>
6764616d0f9Sopenharmony_ci    Although a named location in the <code><abbr>tz</abbr></code>
6774616d0f9Sopenharmony_ci    database stands for the containing region, its pre-1970 data
6784616d0f9Sopenharmony_ci    entries are often accurate for only a small subset of that region.
6794616d0f9Sopenharmony_ci    For example, <code>Europe/London</code> stands for the United
6804616d0f9Sopenharmony_ci    Kingdom, but its pre-1847 times are valid only for locations that
6814616d0f9Sopenharmony_ci    have London's exact meridian, and its 1847 transition
6824616d0f9Sopenharmony_ci    to <abbr>GMT</abbr> is known to be valid only for the L&amp;NW and
6834616d0f9Sopenharmony_ci    the Caledonian railways.
6844616d0f9Sopenharmony_ci  </li>
6854616d0f9Sopenharmony_ci  <li>
6864616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database does not record the
6874616d0f9Sopenharmony_ci    earliest time for which a timezone's
6884616d0f9Sopenharmony_ci    data entries are thereafter valid for every location in the region.
6894616d0f9Sopenharmony_ci    For example, <code>Europe/London</code> is valid for all locations
6904616d0f9Sopenharmony_ci    in its region after <abbr>GMT</abbr> was made the standard time,
6914616d0f9Sopenharmony_ci    but the date of standardization (1880-08-02) is not in the
6924616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code> database, other than in commentary.
6934616d0f9Sopenharmony_ci    For many timezones the earliest time of
6944616d0f9Sopenharmony_ci    validity is unknown.
6954616d0f9Sopenharmony_ci  </li>
6964616d0f9Sopenharmony_ci  <li>
6974616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database does not record a
6984616d0f9Sopenharmony_ci    region's boundaries, and in many cases the boundaries are not known.
6994616d0f9Sopenharmony_ci    For example, the timezone
7004616d0f9Sopenharmony_ci    <code>America/Kentucky/Louisville</code> represents a region
7014616d0f9Sopenharmony_ci    around the city of Louisville, the boundaries of which are
7024616d0f9Sopenharmony_ci    unclear.
7034616d0f9Sopenharmony_ci  </li>
7044616d0f9Sopenharmony_ci  <li>
7054616d0f9Sopenharmony_ci    Changes that are modeled as instantaneous transitions in the
7064616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code>
7074616d0f9Sopenharmony_ci    database were often spread out over hours, days, or even decades.
7084616d0f9Sopenharmony_ci  </li>
7094616d0f9Sopenharmony_ci  <li>
7104616d0f9Sopenharmony_ci    Even if the time is specified by law, locations sometimes
7114616d0f9Sopenharmony_ci    deliberately flout the law.
7124616d0f9Sopenharmony_ci  </li>
7134616d0f9Sopenharmony_ci  <li>
7144616d0f9Sopenharmony_ci    Early timekeeping practices, even assuming perfect clocks, were
7154616d0f9Sopenharmony_ci    often not specified to the accuracy that the
7164616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code> database requires.
7174616d0f9Sopenharmony_ci  </li>
7184616d0f9Sopenharmony_ci  <li>
7194616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database cannot represent stopped clocks.
7204616d0f9Sopenharmony_ci    However, on 1911-03-11 at 00:00, some public-facing French clocks
7214616d0f9Sopenharmony_ci    were changed by stopping them for a few minutes to effect a transition.
7224616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database models this via a
7234616d0f9Sopenharmony_ci    backward transition; the relevant French legislation does not
7244616d0f9Sopenharmony_ci    specify exactly how the transition was to occur.
7254616d0f9Sopenharmony_ci  </li>
7264616d0f9Sopenharmony_ci  <li>
7274616d0f9Sopenharmony_ci    Sometimes historical timekeeping was specified more precisely
7284616d0f9Sopenharmony_ci    than what the <code><abbr>tz</abbr></code> code can handle.
7294616d0f9Sopenharmony_ci    For example, from 1880 to 1916 clocks in Ireland observed Dublin Mean
7304616d0f9Sopenharmony_ci    Time (estimated to be <abbr>UT</abbr>
7314616d0f9Sopenharmony_ci    &minus;00:25:21.1); although the <code><abbr>tz</abbr></code>
7324616d0f9Sopenharmony_ci    source data can represent the .1 second, TZif files and the code cannot.
7334616d0f9Sopenharmony_ci    In practice these old specifications were rarely if ever
7344616d0f9Sopenharmony_ci    implemented to subsecond precision.
7354616d0f9Sopenharmony_ci  </li>
7364616d0f9Sopenharmony_ci  <li>
7374616d0f9Sopenharmony_ci    Even when all the timestamp transitions recorded by the
7384616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code> database are correct, the
7394616d0f9Sopenharmony_ci    <code><abbr>tz</abbr></code> rules that generate them may not
7404616d0f9Sopenharmony_ci    faithfully reflect the historical rules.
7414616d0f9Sopenharmony_ci    For example, from 1922 until World War II the UK moved clocks
7424616d0f9Sopenharmony_ci    forward the day following the third Saturday in April unless that
7434616d0f9Sopenharmony_ci    was Easter, in which case it moved clocks forward the previous
7444616d0f9Sopenharmony_ci    Sunday.
7454616d0f9Sopenharmony_ci    Because the <code><abbr>tz</abbr></code> database has no
7464616d0f9Sopenharmony_ci    way to specify Easter, these exceptional years are entered as
7474616d0f9Sopenharmony_ci    separate <code><abbr>tz</abbr> Rule</code> lines, even though the
7484616d0f9Sopenharmony_ci    legal rules did not change.
7494616d0f9Sopenharmony_ci    When transitions are known but the historical rules behind them are not,
7504616d0f9Sopenharmony_ci    the database contains <code>Zone</code> and <code>Rule</code>
7514616d0f9Sopenharmony_ci    entries that are intended to represent only the generated
7524616d0f9Sopenharmony_ci    transitions, not any underlying historical rules; however, this
7534616d0f9Sopenharmony_ci    intent is recorded at best only in commentary.
7544616d0f9Sopenharmony_ci  </li>
7554616d0f9Sopenharmony_ci  <li>
7564616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database models time
7574616d0f9Sopenharmony_ci    using the <a
7584616d0f9Sopenharmony_ci    href="https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">proleptic
7594616d0f9Sopenharmony_ci    Gregorian calendar</a> with days containing 24 equal-length hours
7604616d0f9Sopenharmony_ci    numbered 00 through 23, except when clock transitions occur.
7614616d0f9Sopenharmony_ci    Pre-standard time is modeled as local mean time.
7624616d0f9Sopenharmony_ci    However, historically many people used other calendars and other timescales.
7634616d0f9Sopenharmony_ci    For example, the Roman Empire used
7644616d0f9Sopenharmony_ci    the <a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian
7654616d0f9Sopenharmony_ci    calendar</a>,
7664616d0f9Sopenharmony_ci    and <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">Roman
7674616d0f9Sopenharmony_ci    timekeeping</a> had twelve varying-length daytime hours with a
7684616d0f9Sopenharmony_ci    non-hour-based system at night.
7694616d0f9Sopenharmony_ci    And even today, some local practices diverge from the Gregorian
7704616d0f9Sopenharmony_ci    calendar with 24-hour days. These divergences range from
7714616d0f9Sopenharmony_ci    relatively minor, such as Japanese bars giving times like "24:30" for the
7724616d0f9Sopenharmony_ci    wee hours of the morning, to more-significant differences such as <a
7734616d0f9Sopenharmony_ci    href="https://theworld.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time">the
7744616d0f9Sopenharmony_ci    east African practice of starting the day at dawn</a>, renumbering
7754616d0f9Sopenharmony_ci    the Western 06:00 to be 12:00. These practices are largely outside
7764616d0f9Sopenharmony_ci    the scope of the <code><abbr>tz</abbr></code> code and data, which
7774616d0f9Sopenharmony_ci    provide only limited support for date and time localization
7784616d0f9Sopenharmony_ci    such as that required by POSIX.1-2017.
7794616d0f9Sopenharmony_ci    If <abbr>DST</abbr> is not used a different time zone
7804616d0f9Sopenharmony_ci    can often do the trick; for example, in Kenya a <code>TZ</code> setting
7814616d0f9Sopenharmony_ci    like <code>&lt;-03&gt;3</code> or <code>America/Cayenne</code> starts
7824616d0f9Sopenharmony_ci    the day six hours later than <code>Africa/Nairobi</code> does.
7834616d0f9Sopenharmony_ci  </li>
7844616d0f9Sopenharmony_ci  <li>
7854616d0f9Sopenharmony_ci    Early clocks were less reliable, and data entries do not represent
7864616d0f9Sopenharmony_ci    clock error.
7874616d0f9Sopenharmony_ci  </li>
7884616d0f9Sopenharmony_ci  <li>
7894616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database assumes Universal Time
7904616d0f9Sopenharmony_ci    (<abbr>UT</abbr>) as an origin, even though <abbr>UT</abbr> is not
7914616d0f9Sopenharmony_ci    standardized for older timestamps.
7924616d0f9Sopenharmony_ci    In the <code><abbr>tz</abbr></code> database commentary,
7934616d0f9Sopenharmony_ci    <abbr>UT</abbr> denotes a family of time standards that includes
7944616d0f9Sopenharmony_ci    Coordinated Universal Time (<abbr>UTC</abbr>) along with other
7954616d0f9Sopenharmony_ci    variants such as <abbr>UT1</abbr> and <abbr>GMT</abbr>,
7964616d0f9Sopenharmony_ci    with days starting at midnight.
7974616d0f9Sopenharmony_ci    Although <abbr>UT</abbr> equals <abbr>UTC</abbr> for modern
7984616d0f9Sopenharmony_ci    timestamps, <abbr>UTC</abbr> was not defined until 1960, so
7994616d0f9Sopenharmony_ci    commentary uses the more general abbreviation <abbr>UT</abbr> for
8004616d0f9Sopenharmony_ci    timestamps that might predate 1960.
8014616d0f9Sopenharmony_ci    Since <abbr>UT</abbr>, <abbr>UT1</abbr>, etc. disagree slightly,
8024616d0f9Sopenharmony_ci    and since pre-1972 <abbr>UTC</abbr> seconds varied in length,
8034616d0f9Sopenharmony_ci    interpretation of older timestamps can be problematic when
8044616d0f9Sopenharmony_ci    subsecond accuracy is needed.
8054616d0f9Sopenharmony_ci  </li>
8064616d0f9Sopenharmony_ci  <li>
8074616d0f9Sopenharmony_ci    Civil time was not based on atomic time before 1972, and we do not
8084616d0f9Sopenharmony_ci    know the history of
8094616d0f9Sopenharmony_ci    <a href="https://en.wikipedia.org/wiki/Earth's_rotation">earth's
8104616d0f9Sopenharmony_ci    rotation</a> accurately enough to map <a
8114616d0f9Sopenharmony_ci    href="https://en.wikipedia.org/wiki/International_System_of_Units"><abbr
8124616d0f9Sopenharmony_ci    title="International System of Units">SI</abbr></a> seconds to
8134616d0f9Sopenharmony_ci    historical <a href="https://en.wikipedia.org/wiki/Solar_time">solar time</a>
8144616d0f9Sopenharmony_ci    to more than about one-hour accuracy.
8154616d0f9Sopenharmony_ci    See: Stephenson FR, Morrison LV, Hohenkerk CY.
8164616d0f9Sopenharmony_ci    <a href="https://dx.doi.org/10.1098/rspa.2016.0404">Measurement of
8174616d0f9Sopenharmony_ci    the Earth's rotation: 720 BC to AD 2015</a>.
8184616d0f9Sopenharmony_ci    <cite>Proc Royal Soc A</cite>. 2016;472:20160404.
8194616d0f9Sopenharmony_ci    Also see: Espenak F. <a
8204616d0f9Sopenharmony_ci    href="https://eclipse.gsfc.nasa.gov/SEhelp/uncertainty2004.html">Uncertainty
8214616d0f9Sopenharmony_ci    in Delta T (ΔT)</a>.
8224616d0f9Sopenharmony_ci  </li>
8234616d0f9Sopenharmony_ci  <li>
8244616d0f9Sopenharmony_ci    The relationship between POSIX time (that is, <abbr>UTC</abbr> but
8254616d0f9Sopenharmony_ci    ignoring <a href="https://en.wikipedia.org/wiki/Leap_second">leap
8264616d0f9Sopenharmony_ci    seconds</a>) and <abbr>UTC</abbr> is not agreed upon.
8274616d0f9Sopenharmony_ci    This affects time stamps during the leap second era (1972&ndash;2035).
8284616d0f9Sopenharmony_ci    Although the POSIX
8294616d0f9Sopenharmony_ci    clock officially stops during an inserted leap second, at least one
8304616d0f9Sopenharmony_ci    proposed standard has it jumping back a second instead; and in
8314616d0f9Sopenharmony_ci    practice POSIX clocks more typically either progress glacially during
8324616d0f9Sopenharmony_ci    a leap second, or are slightly slowed while near a leap second.
8334616d0f9Sopenharmony_ci  </li>
8344616d0f9Sopenharmony_ci  <li>
8354616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> database does not represent how
8364616d0f9Sopenharmony_ci    uncertain its information is.
8374616d0f9Sopenharmony_ci    Ideally it would contain information about when data entries are
8384616d0f9Sopenharmony_ci    incomplete or dicey.
8394616d0f9Sopenharmony_ci    Partial temporal knowledge is a field of active research, though,
8404616d0f9Sopenharmony_ci    and it is not clear how to apply it here.
8414616d0f9Sopenharmony_ci  </li>
8424616d0f9Sopenharmony_ci</ul>
8434616d0f9Sopenharmony_ci
8444616d0f9Sopenharmony_ci<p>
8454616d0f9Sopenharmony_ciIn short, many, perhaps most, of the <code><abbr>tz</abbr></code>
8464616d0f9Sopenharmony_cidatabase's pre-1970 and future timestamps are either wrong or
8474616d0f9Sopenharmony_cimisleading.
8484616d0f9Sopenharmony_ciAny attempt to pass the
8494616d0f9Sopenharmony_ci<code><abbr>tz</abbr></code> database off as the definition of time
8504616d0f9Sopenharmony_cishould be unacceptable to anybody who cares about the facts.
8514616d0f9Sopenharmony_ciIn particular, the <code><abbr>tz</abbr></code> database's
8524616d0f9Sopenharmony_ci<abbr>LMT</abbr> offsets should not be considered meaningful, and
8534616d0f9Sopenharmony_cishould not prompt creation of timezones
8544616d0f9Sopenharmony_cimerely because two locations
8554616d0f9Sopenharmony_cidiffer in <abbr>LMT</abbr> or transitioned to standard time at
8564616d0f9Sopenharmony_cidifferent dates.
8574616d0f9Sopenharmony_ci</p>
8584616d0f9Sopenharmony_ci</section>
8594616d0f9Sopenharmony_ci
8604616d0f9Sopenharmony_ci<section>
8614616d0f9Sopenharmony_ci  <h2 id="functions">Time and date functions</h2>
8624616d0f9Sopenharmony_ci<p>
8634616d0f9Sopenharmony_ciThe <code><abbr>tz</abbr></code> code contains time and date functions
8644616d0f9Sopenharmony_cithat are upwards compatible with those of POSIX.
8654616d0f9Sopenharmony_ciCode compatible with this package is already
8664616d0f9Sopenharmony_ci<a href="tz-link.html#tzdb">part of many platforms</a>, where the
8674616d0f9Sopenharmony_ciprimary use of this package is to update obsolete time-related files.
8684616d0f9Sopenharmony_ciTo do this, you may need to compile the time zone compiler
8694616d0f9Sopenharmony_ci'<code>zic</code>' supplied with this package instead of using the
8704616d0f9Sopenharmony_cisystem '<code>zic</code>', since the format of <code>zic</code>'s
8714616d0f9Sopenharmony_ciinput is occasionally extended, and a platform may still be shipping
8724616d0f9Sopenharmony_cian older <code>zic</code>.
8734616d0f9Sopenharmony_ci</p>
8744616d0f9Sopenharmony_ci
8754616d0f9Sopenharmony_ci<h3 id="POSIX">POSIX.1-2017 properties and limitations</h3>
8764616d0f9Sopenharmony_ci<ul>
8774616d0f9Sopenharmony_ci  <li>
8784616d0f9Sopenharmony_ci    <p>
8794616d0f9Sopenharmony_ci    In POSIX.1-2017, time display in a process is controlled by the
8804616d0f9Sopenharmony_ci    environment variable <code>TZ</code>.
8814616d0f9Sopenharmony_ci    Unfortunately, the POSIX.1-2017
8824616d0f9Sopenharmony_ci    <code>TZ</code> string takes a form that is hard to describe and
8834616d0f9Sopenharmony_ci    is error-prone in practice.
8844616d0f9Sopenharmony_ci    Also, POSIX.1-2017 <code>TZ</code> strings cannot deal with daylight
8854616d0f9Sopenharmony_ci    saving time rules not based on the Gregorian calendar (as in
8864616d0f9Sopenharmony_ci    Morocco), or with situations where more than two time zone
8874616d0f9Sopenharmony_ci    abbreviations or <abbr>UT</abbr> offsets are used in an area.
8884616d0f9Sopenharmony_ci    </p>
8894616d0f9Sopenharmony_ci
8904616d0f9Sopenharmony_ci    <p>
8914616d0f9Sopenharmony_ci    The POSIX.1-2017 <code>TZ</code> string takes the following form:
8924616d0f9Sopenharmony_ci    </p>
8934616d0f9Sopenharmony_ci
8944616d0f9Sopenharmony_ci    <p>
8954616d0f9Sopenharmony_ci    <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>]]]
8964616d0f9Sopenharmony_ci    </p>
8974616d0f9Sopenharmony_ci
8984616d0f9Sopenharmony_ci    <p>
8994616d0f9Sopenharmony_ci    where:
9004616d0f9Sopenharmony_ci    </p>
9014616d0f9Sopenharmony_ci
9024616d0f9Sopenharmony_ci    <dl>
9034616d0f9Sopenharmony_ci      <dt><var>std</var> and <var>dst</var></dt><dd>
9044616d0f9Sopenharmony_ci	are 3 or more characters specifying the standard
9054616d0f9Sopenharmony_ci	and daylight saving time (<abbr>DST</abbr>) zone abbreviations.
9064616d0f9Sopenharmony_ci	Starting with POSIX.1-2001, <var>std</var> and <var>dst</var>
9074616d0f9Sopenharmony_ci	may also be in a quoted form like '<code>&lt;+09&gt;</code>';
9084616d0f9Sopenharmony_ci	this allows "<code>+</code>" and "<code>-</code>" in the names.
9094616d0f9Sopenharmony_ci      </dd>
9104616d0f9Sopenharmony_ci      <dt><var>offset</var></dt><dd>
9114616d0f9Sopenharmony_ci	is of the form
9124616d0f9Sopenharmony_ci	'<code>[&plusmn;]<var>hh</var>:[<var>mm</var>[:<var>ss</var>]]</code>'
9134616d0f9Sopenharmony_ci	and specifies the offset west of <abbr>UT</abbr>.
9144616d0f9Sopenharmony_ci	'<var>hh</var>' may be a single digit;
9154616d0f9Sopenharmony_ci	0&le;<var>hh</var>&le;24.
9164616d0f9Sopenharmony_ci	The default <abbr>DST</abbr> offset is one hour ahead of
9174616d0f9Sopenharmony_ci	standard time.
9184616d0f9Sopenharmony_ci      </dd>
9194616d0f9Sopenharmony_ci      <dt><var>date</var>[<code>/</code><var>time</var>]<code>,</code><var>date</var>[<code>/</code><var>time</var>]</dt><dd>
9204616d0f9Sopenharmony_ci	specifies the beginning and end of <abbr>DST</abbr>.
9214616d0f9Sopenharmony_ci	If this is absent, the system supplies its own ruleset
9224616d0f9Sopenharmony_ci	for <abbr>DST</abbr>, typically	current <abbr>US</abbr>
9234616d0f9Sopenharmony_ci	<abbr>DST</abbr> rules.
9244616d0f9Sopenharmony_ci      </dd>
9254616d0f9Sopenharmony_ci      <dt><var>time</var></dt><dd>
9264616d0f9Sopenharmony_ci	takes the form
9274616d0f9Sopenharmony_ci	'<var>hh</var><code>:</code>[<var>mm</var>[<code>:</code><var>ss</var>]]'
9284616d0f9Sopenharmony_ci	and defaults to 02:00.
9294616d0f9Sopenharmony_ci	This is the same format as the offset, except that a
9304616d0f9Sopenharmony_ci	leading '<code>+</code>' or '<code>-</code>' is not allowed.
9314616d0f9Sopenharmony_ci      </dd>
9324616d0f9Sopenharmony_ci      <dt><var>date</var></dt><dd>
9334616d0f9Sopenharmony_ci	takes one of the following forms:
9344616d0f9Sopenharmony_ci	<dl>
9354616d0f9Sopenharmony_ci	  <dt>J<var>n</var> (1&le;<var>n</var>&le;365)</dt><dd>
9364616d0f9Sopenharmony_ci	    origin-1 day number not counting February 29
9374616d0f9Sopenharmony_ci	  </dd>
9384616d0f9Sopenharmony_ci	  <dt><var>n</var> (0&le;<var>n</var>&le;365)</dt><dd>
9394616d0f9Sopenharmony_ci	    origin-0 day number counting February 29 if present
9404616d0f9Sopenharmony_ci	  </dd>
9414616d0f9Sopenharmony_ci	  <dt><code>M</code><var>m</var><code>.</code><var>n</var><code>.</code><var>d</var>
9424616d0f9Sopenharmony_ci	    (0[Sunday]&le;<var>d</var>&le;6[Saturday], 1&le;<var>n</var>&le;5,
9434616d0f9Sopenharmony_ci	    1&le;<var>m</var>&le;12)</dt><dd>
9444616d0f9Sopenharmony_ci	    for the <var>d</var>th day of week <var>n</var> of
9454616d0f9Sopenharmony_ci	    month <var>m</var> of the year, where week 1 is the first
9464616d0f9Sopenharmony_ci	    week in which day <var>d</var> appears, and
9474616d0f9Sopenharmony_ci	    '<code>5</code>' stands for the last week in which
9484616d0f9Sopenharmony_ci	    day <var>d</var> appears (which may be either the 4th or
9494616d0f9Sopenharmony_ci	    5th week).
9504616d0f9Sopenharmony_ci	    Typically, this is the only useful form; the <var>n</var>
9514616d0f9Sopenharmony_ci	    and <code>J</code><var>n</var> forms are rarely used.
9524616d0f9Sopenharmony_ci	  </dd>
9534616d0f9Sopenharmony_ci	</dl>
9544616d0f9Sopenharmony_ci      </dd>
9554616d0f9Sopenharmony_ci    </dl>
9564616d0f9Sopenharmony_ci
9574616d0f9Sopenharmony_ci    <p>
9584616d0f9Sopenharmony_ci    Here is an example POSIX.1-2017 <code>TZ</code> string for New
9594616d0f9Sopenharmony_ci    Zealand after 2007.
9604616d0f9Sopenharmony_ci    It says that standard time (<abbr>NZST</abbr>) is 12 hours ahead
9614616d0f9Sopenharmony_ci    of <abbr>UT</abbr>, and that daylight saving time
9624616d0f9Sopenharmony_ci    (<abbr>NZDT</abbr>) is observed from September's last Sunday at
9634616d0f9Sopenharmony_ci    02:00 until April's first Sunday at 03:00:
9644616d0f9Sopenharmony_ci    </p>
9654616d0f9Sopenharmony_ci
9664616d0f9Sopenharmony_ci    <pre><code>TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'</code></pre>
9674616d0f9Sopenharmony_ci
9684616d0f9Sopenharmony_ci    <p>
9694616d0f9Sopenharmony_ci    This POSIX.1-2017 <code>TZ</code> string is hard to remember, and
9704616d0f9Sopenharmony_ci    mishandles some timestamps before 2008.
9714616d0f9Sopenharmony_ci    With this package you can use this instead:
9724616d0f9Sopenharmony_ci    </p>
9734616d0f9Sopenharmony_ci
9744616d0f9Sopenharmony_ci    <pre><code>TZ='Pacific/Auckland'</code></pre>
9754616d0f9Sopenharmony_ci  </li>
9764616d0f9Sopenharmony_ci  <li>
9774616d0f9Sopenharmony_ci    POSIX does not define the <abbr>DST</abbr> transitions
9784616d0f9Sopenharmony_ci    for <code>TZ</code> values like
9794616d0f9Sopenharmony_ci    "<code>EST5EDT</code>".
9804616d0f9Sopenharmony_ci    Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
9814616d0f9Sopenharmony_ci    were used to interpret such values, but this meant that the
9824616d0f9Sopenharmony_ci    <abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
9834616d0f9Sopenharmony_ci    time conversion package, and when
9844616d0f9Sopenharmony_ci    <abbr>US</abbr> time conversion rules changed (as in the United
9854616d0f9Sopenharmony_ci    States in 1987 and again in 2007), all packages that
9864616d0f9Sopenharmony_ci    interpreted <code>TZ</code> values had to be updated
9874616d0f9Sopenharmony_ci    to ensure proper results.
9884616d0f9Sopenharmony_ci  </li>
9894616d0f9Sopenharmony_ci  <li>
9904616d0f9Sopenharmony_ci    The <code>TZ</code> environment variable is process-global, which
9914616d0f9Sopenharmony_ci    makes it hard to write efficient, thread-safe applications that
9924616d0f9Sopenharmony_ci    need access to multiple timezones.
9934616d0f9Sopenharmony_ci  </li>
9944616d0f9Sopenharmony_ci  <li>
9954616d0f9Sopenharmony_ci    In POSIX, there is no tamper-proof way for a process to learn the
9964616d0f9Sopenharmony_ci    system's best idea of local (wall clock) time.
9974616d0f9Sopenharmony_ci    This is important for applications that an administrator wants
9984616d0f9Sopenharmony_ci    used only at certain times &ndash; without regard to whether the
9994616d0f9Sopenharmony_ci    user has fiddled the
10004616d0f9Sopenharmony_ci    <code>TZ</code> environment variable.
10014616d0f9Sopenharmony_ci    While an administrator can "do everything in <abbr>UT</abbr>" to
10024616d0f9Sopenharmony_ci    get around the problem, doing so is inconvenient and precludes
10034616d0f9Sopenharmony_ci    handling daylight saving time shifts &ndash; as might be required to
10044616d0f9Sopenharmony_ci    limit phone calls to off-peak hours.
10054616d0f9Sopenharmony_ci  </li>
10064616d0f9Sopenharmony_ci  <li>
10074616d0f9Sopenharmony_ci    POSIX.1-2017 provides no convenient and efficient way to determine
10084616d0f9Sopenharmony_ci    the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
10094616d0f9Sopenharmony_ci    timestamps, particularly for timezones
10104616d0f9Sopenharmony_ci    that do not fit into the POSIX model.
10114616d0f9Sopenharmony_ci  </li>
10124616d0f9Sopenharmony_ci  <li>
10134616d0f9Sopenharmony_ci    POSIX requires that <code>time_t</code> clock counts exclude leap
10144616d0f9Sopenharmony_ci    seconds.
10154616d0f9Sopenharmony_ci  </li>
10164616d0f9Sopenharmony_ci  <li>
10174616d0f9Sopenharmony_ci    The <code><abbr>tz</abbr></code> code attempts to support all the
10184616d0f9Sopenharmony_ci    <code>time_t</code> implementations allowed by POSIX.
10194616d0f9Sopenharmony_ci    The <code>time_t</code> type represents a nonnegative count of seconds
10204616d0f9Sopenharmony_ci    since 1970-01-01 00:00:00 <abbr>UTC</abbr>, ignoring leap seconds.
10214616d0f9Sopenharmony_ci    In practice, <code>time_t</code> is usually a signed 64- or 32-bit
10224616d0f9Sopenharmony_ci    integer; 32-bit signed <code>time_t</code> values stop working after
10234616d0f9Sopenharmony_ci    2038-01-19 03:14:07 <abbr>UTC</abbr>, so new implementations these
10244616d0f9Sopenharmony_ci    days typically use a signed 64-bit integer.
10254616d0f9Sopenharmony_ci    Unsigned 32-bit integers are used on one or two platforms, and 36-bit
10264616d0f9Sopenharmony_ci    and 40-bit integers are also used occasionally.
10274616d0f9Sopenharmony_ci    Although earlier POSIX versions allowed <code>time_t</code> to be a
10284616d0f9Sopenharmony_ci    floating-point type, this was not supported by any practical system,
10294616d0f9Sopenharmony_ci    and POSIX.1-2013 and the <code><abbr>tz</abbr></code> code both
10304616d0f9Sopenharmony_ci    require <code>time_t</code> to be an integer type.
10314616d0f9Sopenharmony_ci  </li>
10324616d0f9Sopenharmony_ci</ul>
10334616d0f9Sopenharmony_ci
10344616d0f9Sopenharmony_ci<h3 id="POSIX-extensions">Extensions to POSIX.1-2017 in the
10354616d0f9Sopenharmony_ci<code><abbr>tz</abbr></code> code</h3>
10364616d0f9Sopenharmony_ci<ul>
10374616d0f9Sopenharmony_ci  <li>
10384616d0f9Sopenharmony_ci    <p>
10394616d0f9Sopenharmony_ci    The <code>TZ</code> environment variable is used in generating
10404616d0f9Sopenharmony_ci    the name of a file from which time-related information is read
10414616d0f9Sopenharmony_ci    (or is interpreted à la POSIX.1-2017); <code>TZ</code> is no longer
10424616d0f9Sopenharmony_ci    constrained to be a string containing abbreviations
10434616d0f9Sopenharmony_ci    and numeric data as described <a href="#POSIX">above</a>.
10444616d0f9Sopenharmony_ci    The file's format is <dfn><abbr>TZif</abbr></dfn>,
10454616d0f9Sopenharmony_ci    a timezone information format that contains binary data; see
10464616d0f9Sopenharmony_ci    <a href="https://datatracker.ietf.org/doc/html/8536">Internet
10474616d0f9Sopenharmony_ci    <abbr>RFC</abbr> 8536</a>.
10484616d0f9Sopenharmony_ci    The daylight saving time rules to be used for a
10494616d0f9Sopenharmony_ci    particular timezone are encoded in the
10504616d0f9Sopenharmony_ci    <abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
10514616d0f9Sopenharmony_ci    Australian, and other rules to be encoded, and
10524616d0f9Sopenharmony_ci    allows for situations where more than two time zone
10534616d0f9Sopenharmony_ci    abbreviations are used.
10544616d0f9Sopenharmony_ci    </p>
10554616d0f9Sopenharmony_ci    <p>
10564616d0f9Sopenharmony_ci    It was recognized that allowing the <code>TZ</code> environment
10574616d0f9Sopenharmony_ci    variable to take on values such as '<code>America/New_York</code>'
10584616d0f9Sopenharmony_ci    might cause "old" programs (that expect <code>TZ</code> to have a
10594616d0f9Sopenharmony_ci    certain form) to operate incorrectly; consideration was given to using
10604616d0f9Sopenharmony_ci    some other environment variable (for example, <code>TIMEZONE</code>)
10614616d0f9Sopenharmony_ci    to hold the string used to generate the <abbr>TZif</abbr> file's name.
10624616d0f9Sopenharmony_ci    In the end, however, it was decided to continue using
10634616d0f9Sopenharmony_ci    <code>TZ</code>: it is widely used for time zone purposes;
10644616d0f9Sopenharmony_ci    separately maintaining both <code>TZ</code>
10654616d0f9Sopenharmony_ci    and <code>TIMEZONE</code> seemed a nuisance; and systems where
10664616d0f9Sopenharmony_ci    "new" forms of <code>TZ</code> might cause problems can simply
10674616d0f9Sopenharmony_ci    use legacy <code>TZ</code> values such as "<code>EST5EDT</code>" which
10684616d0f9Sopenharmony_ci    can be used by "new" programs as well as by "old" programs that
10694616d0f9Sopenharmony_ci    assume pre-POSIX <code>TZ</code> values.
10704616d0f9Sopenharmony_ci    </p>
10714616d0f9Sopenharmony_ci  </li>
10724616d0f9Sopenharmony_ci  <li>
10734616d0f9Sopenharmony_ci    The code supports platforms with a <abbr>UT</abbr> offset member
10744616d0f9Sopenharmony_ci    in <code>struct tm</code>, e.g., <code>tm_gmtoff</code>,
10754616d0f9Sopenharmony_ci    or with a time zone abbreviation member in
10764616d0f9Sopenharmony_ci    <code>struct tm</code>, e.g., <code>tm_zone</code>. As noted
10774616d0f9Sopenharmony_ci    in <a href="https://austingroupbugs.net/view.php?id=1533">Austin
10784616d0f9Sopenharmony_ci    Group defect 1533</a>, a future version of POSIX is planned to
10794616d0f9Sopenharmony_ci    require <code>tm_gmtoff</code> and <code>tm_zone</code>.
10804616d0f9Sopenharmony_ci  </li>
10814616d0f9Sopenharmony_ci  <li>
10824616d0f9Sopenharmony_ci    Functions <code>tzalloc</code>, <code>tzfree</code>,
10834616d0f9Sopenharmony_ci    <code>localtime_rz</code>, and <code>mktime_z</code> for
10844616d0f9Sopenharmony_ci    more-efficient thread-safe applications that need to use multiple
10854616d0f9Sopenharmony_ci    timezones.
10864616d0f9Sopenharmony_ci    The <code>tzalloc</code> and <code>tzfree</code> functions
10874616d0f9Sopenharmony_ci    allocate and free objects of type <code>timezone_t</code>,
10884616d0f9Sopenharmony_ci    and <code>localtime_rz</code> and <code>mktime_z</code> are
10894616d0f9Sopenharmony_ci    like <code>localtime_r</code> and <code>mktime</code> with an
10904616d0f9Sopenharmony_ci    extra <code>timezone_t</code> argument.
10914616d0f9Sopenharmony_ci    The functions were inspired by <a href="https://netbsd.org/">NetBSD</a>.
10924616d0f9Sopenharmony_ci  </li>
10934616d0f9Sopenharmony_ci  <li>
10944616d0f9Sopenharmony_ci    Negative <code>time_t</code> values are supported, on systems
10954616d0f9Sopenharmony_ci    where <code>time_t</code> is signed.
10964616d0f9Sopenharmony_ci  </li>
10974616d0f9Sopenharmony_ci  <li>
10984616d0f9Sopenharmony_ci    These functions can account for leap seconds;
10994616d0f9Sopenharmony_ci    see <a href="#leapsec">Leap seconds</a> below.
11004616d0f9Sopenharmony_ci  </li>
11014616d0f9Sopenharmony_ci</ul>
11024616d0f9Sopenharmony_ci
11034616d0f9Sopenharmony_ci<h3 id="vestigial">POSIX features no longer needed</h3>
11044616d0f9Sopenharmony_ci<p>
11054616d0f9Sopenharmony_ciPOSIX and <a href="https://en.wikipedia.org/wiki/ISO_C"><abbr>ISO</abbr> C</a>
11064616d0f9Sopenharmony_cidefine some <a href="https://en.wikipedia.org/wiki/API"><abbr
11074616d0f9Sopenharmony_cititle="application programming interface">API</abbr>s</a> that are vestigial:
11084616d0f9Sopenharmony_cithey are not needed, and are relics of a too-simple model that does
11094616d0f9Sopenharmony_cinot suffice to handle many real-world timestamps.
11104616d0f9Sopenharmony_ciAlthough the <code><abbr>tz</abbr></code> code supports these
11114616d0f9Sopenharmony_civestigial <abbr>API</abbr>s for backwards compatibility, they should
11124616d0f9Sopenharmony_cibe avoided in portable applications.
11134616d0f9Sopenharmony_ciThe vestigial <abbr>API</abbr>s are:
11144616d0f9Sopenharmony_ci</p>
11154616d0f9Sopenharmony_ci<ul>
11164616d0f9Sopenharmony_ci  <li>
11174616d0f9Sopenharmony_ci    The POSIX <code>tzname</code> variable does not suffice and is no
11184616d0f9Sopenharmony_ci    longer needed.
11194616d0f9Sopenharmony_ci    To get a timestamp's time zone abbreviation, consult
11204616d0f9Sopenharmony_ci    the <code>tm_zone</code> member if available; otherwise,
11214616d0f9Sopenharmony_ci    use <code>strftime</code>'s <code>"%Z"</code> conversion
11224616d0f9Sopenharmony_ci    specification.
11234616d0f9Sopenharmony_ci  </li>
11244616d0f9Sopenharmony_ci  <li>
11254616d0f9Sopenharmony_ci    The POSIX <code>daylight</code> and <code>timezone</code>
11264616d0f9Sopenharmony_ci    variables do not suffice and are no longer needed.
11274616d0f9Sopenharmony_ci    To get a timestamp's <abbr>UT</abbr> offset, consult
11284616d0f9Sopenharmony_ci    the <code>tm_gmtoff</code> member if available; otherwise,
11294616d0f9Sopenharmony_ci    subtract values returned by <code>localtime</code>
11304616d0f9Sopenharmony_ci    and <code>gmtime</code> using the rules of the Gregorian calendar,
11314616d0f9Sopenharmony_ci    or use <code>strftime</code>'s <code>"%z"</code> conversion
11324616d0f9Sopenharmony_ci    specification if a string like <code>"+0900"</code> suffices.
11334616d0f9Sopenharmony_ci  </li>
11344616d0f9Sopenharmony_ci  <li>
11354616d0f9Sopenharmony_ci    The <code>tm_isdst</code> member is almost never needed and most of
11364616d0f9Sopenharmony_ci    its uses should be discouraged in favor of the abovementioned
11374616d0f9Sopenharmony_ci    <abbr>API</abbr>s.
11384616d0f9Sopenharmony_ci    Although it can still be used in arguments to
11394616d0f9Sopenharmony_ci    <code>mktime</code> to disambiguate timestamps near
11404616d0f9Sopenharmony_ci    a <abbr>DST</abbr> transition when the clock jumps back on
11414616d0f9Sopenharmony_ci    platforms lacking <code>tm_gmtoff</code>, this
11424616d0f9Sopenharmony_ci    disambiguation does not work when standard time itself jumps back,
11434616d0f9Sopenharmony_ci    which can occur when a location changes to a time zone with a
11444616d0f9Sopenharmony_ci    lesser <abbr>UT</abbr> offset.
11454616d0f9Sopenharmony_ci  </li>
11464616d0f9Sopenharmony_ci</ul>
11474616d0f9Sopenharmony_ci
11484616d0f9Sopenharmony_ci<h3 id="other-portability">Other portability notes</h3>
11494616d0f9Sopenharmony_ci<ul>
11504616d0f9Sopenharmony_ci  <li>
11514616d0f9Sopenharmony_ci    The <a href="https://en.wikipedia.org/wiki/Version_7_Unix">7th Edition
11524616d0f9Sopenharmony_ci    UNIX</a> <code>timezone</code> function is not present in this
11534616d0f9Sopenharmony_ci    package; it is impossible to reliably map <code>timezone</code>'s
11544616d0f9Sopenharmony_ci    arguments (a "minutes west of <abbr>GMT</abbr>" value and a
11554616d0f9Sopenharmony_ci    "daylight saving time in effect" flag) to a time zone
11564616d0f9Sopenharmony_ci    abbreviation, and we refuse to guess.
11574616d0f9Sopenharmony_ci    Programs that in the past used the <code>timezone</code> function
11584616d0f9Sopenharmony_ci    may now examine <code>localtime(&amp;clock)-&gt;tm_zone</code>
11594616d0f9Sopenharmony_ci    (if <code>TM_ZONE</code> is defined) or
11604616d0f9Sopenharmony_ci    <code>tzname[localtime(&amp;clock)-&gt;tm_isdst]</code>
11614616d0f9Sopenharmony_ci    (if <code>HAVE_TZNAME</code> is nonzero) to learn the correct time
11624616d0f9Sopenharmony_ci    zone abbreviation to use.
11634616d0f9Sopenharmony_ci  </li>
11644616d0f9Sopenharmony_ci  <li>
11654616d0f9Sopenharmony_ci    The <a
11664616d0f9Sopenharmony_ci    href="https://en.wikipedia.org/wiki/History_of_the_Berkeley_Software_Distribution#4.2BSD"><abbr>4.2BSD</abbr></a>
11674616d0f9Sopenharmony_ci    <code>gettimeofday</code> function is not
11684616d0f9Sopenharmony_ci    used in this package.
11694616d0f9Sopenharmony_ci    This formerly let users obtain the current <abbr>UTC</abbr> offset
11704616d0f9Sopenharmony_ci    and <abbr>DST</abbr> flag, but this functionality was removed in
11714616d0f9Sopenharmony_ci    later versions of <abbr>BSD</abbr>.
11724616d0f9Sopenharmony_ci  </li>
11734616d0f9Sopenharmony_ci  <li>
11744616d0f9Sopenharmony_ci    In <abbr>SVR2</abbr>, time conversion fails for near-minimum or
11754616d0f9Sopenharmony_ci    near-maximum <code>time_t</code> values when doing conversions
11764616d0f9Sopenharmony_ci    for places that do not use <abbr>UT</abbr>.
11774616d0f9Sopenharmony_ci    This package takes care to do these conversions correctly.
11784616d0f9Sopenharmony_ci    A comment in the source code tells how to get compatibly wrong
11794616d0f9Sopenharmony_ci    results.
11804616d0f9Sopenharmony_ci  </li>
11814616d0f9Sopenharmony_ci  <li>
11824616d0f9Sopenharmony_ci    The functions that are conditionally compiled
11834616d0f9Sopenharmony_ci    if <code>STD_INSPIRED</code> is nonzero should, at this point, be
11844616d0f9Sopenharmony_ci    looked on primarily as food for thought.
11854616d0f9Sopenharmony_ci    They are not in any sense "standard compatible" &ndash; some are
11864616d0f9Sopenharmony_ci    not, in fact, specified in <em>any</em> standard.
11874616d0f9Sopenharmony_ci    They do, however, represent responses of various authors to
11884616d0f9Sopenharmony_ci    standardization proposals.
11894616d0f9Sopenharmony_ci  </li>
11904616d0f9Sopenharmony_ci  <li>
11914616d0f9Sopenharmony_ci    Other time conversion proposals, in particular those supported by the
11924616d0f9Sopenharmony_ci    <a href="https://howardhinnant.github.io/date/tz.html">Time Zone
11934616d0f9Sopenharmony_ci    Database Parser</a>, offer a wider selection of functions
11944616d0f9Sopenharmony_ci    that provide capabilities beyond those provided here.
11954616d0f9Sopenharmony_ci    The absence of such functions from this package is not meant to
11964616d0f9Sopenharmony_ci    discourage the development, standardization, or use of such
11974616d0f9Sopenharmony_ci    functions.
11984616d0f9Sopenharmony_ci    Rather, their absence reflects the decision to make this package
11994616d0f9Sopenharmony_ci    contain valid extensions to POSIX, to ensure its broad
12004616d0f9Sopenharmony_ci    acceptability.
12014616d0f9Sopenharmony_ci    If more powerful time conversion functions can be standardized, so
12024616d0f9Sopenharmony_ci    much the better.
12034616d0f9Sopenharmony_ci  </li>
12044616d0f9Sopenharmony_ci</ul>
12054616d0f9Sopenharmony_ci</section>
12064616d0f9Sopenharmony_ci
12074616d0f9Sopenharmony_ci<section>
12084616d0f9Sopenharmony_ci  <h2 id="stability">Interface stability</h2>
12094616d0f9Sopenharmony_ci<p>
12104616d0f9Sopenharmony_ciThe <code><abbr>tz</abbr></code> code and data supply the following interfaces:
12114616d0f9Sopenharmony_ci</p>
12124616d0f9Sopenharmony_ci
12134616d0f9Sopenharmony_ci<ul>
12144616d0f9Sopenharmony_ci  <li>
12154616d0f9Sopenharmony_ci    A set of timezone names as per
12164616d0f9Sopenharmony_ci      "<a href="#naming">Timezone identifiers</a>" above.
12174616d0f9Sopenharmony_ci  </li>
12184616d0f9Sopenharmony_ci  <li>
12194616d0f9Sopenharmony_ci    Library functions described in "<a href="#functions">Time and date
12204616d0f9Sopenharmony_ci      functions</a>" above.
12214616d0f9Sopenharmony_ci  </li>
12224616d0f9Sopenharmony_ci  <li>
12234616d0f9Sopenharmony_ci    The programs <code>tzselect</code>, <code>zdump</code>,
12244616d0f9Sopenharmony_ci    and <code>zic</code>, documented in their man pages.
12254616d0f9Sopenharmony_ci  </li>
12264616d0f9Sopenharmony_ci  <li>
12274616d0f9Sopenharmony_ci    The format of <code>zic</code> input files, documented in
12284616d0f9Sopenharmony_ci    the <code>zic</code> man page.
12294616d0f9Sopenharmony_ci  </li>
12304616d0f9Sopenharmony_ci  <li>
12314616d0f9Sopenharmony_ci    The format of <code>zic</code> output files, documented in
12324616d0f9Sopenharmony_ci    the <code>tzfile</code> man page.
12334616d0f9Sopenharmony_ci  </li>
12344616d0f9Sopenharmony_ci  <li>
12354616d0f9Sopenharmony_ci    The format of zone table files, documented in <code>zone1970.tab</code>.
12364616d0f9Sopenharmony_ci  </li>
12374616d0f9Sopenharmony_ci  <li>
12384616d0f9Sopenharmony_ci    The format of the country code file, documented in <code>iso3166.tab</code>.
12394616d0f9Sopenharmony_ci  </li>
12404616d0f9Sopenharmony_ci  <li>
12414616d0f9Sopenharmony_ci    The version number of the code and data, as the first line of
12424616d0f9Sopenharmony_ci    the text file '<code>version</code>' in each release.
12434616d0f9Sopenharmony_ci  </li>
12444616d0f9Sopenharmony_ci</ul>
12454616d0f9Sopenharmony_ci
12464616d0f9Sopenharmony_ci<p>
12474616d0f9Sopenharmony_ciInterface changes in a release attempt to preserve compatibility with
12484616d0f9Sopenharmony_cirecent releases.
12494616d0f9Sopenharmony_ciFor example, <code><abbr>tz</abbr></code> data files typically do not
12504616d0f9Sopenharmony_cirely on recently added <code>zic</code> features, so that users can
12514616d0f9Sopenharmony_cirun older <code>zic</code> versions to process newer data files.
12524616d0f9Sopenharmony_ci<a href="tz-link.html#download">Downloading
12534616d0f9Sopenharmony_cithe <code><abbr>tz</abbr></code> database</a> describes how releases
12544616d0f9Sopenharmony_ciare tagged and distributed.
12554616d0f9Sopenharmony_ci</p>
12564616d0f9Sopenharmony_ci
12574616d0f9Sopenharmony_ci<p>
12584616d0f9Sopenharmony_ciInterfaces not listed above are less stable.
12594616d0f9Sopenharmony_ciFor example, users should not rely on particular <abbr>UT</abbr>
12604616d0f9Sopenharmony_cioffsets or abbreviations for timestamps, as data entries are often
12614616d0f9Sopenharmony_cibased on guesswork and these guesses may be corrected or improved.
12624616d0f9Sopenharmony_ci</p>
12634616d0f9Sopenharmony_ci
12644616d0f9Sopenharmony_ci<p>
12654616d0f9Sopenharmony_ciTimezone boundaries are not part of the stable interface.
12664616d0f9Sopenharmony_ciFor example, even though the <samp>Asia/Bangkok</samp> timezone
12674616d0f9Sopenharmony_cicurrently includes Chang Mai, Hanoi, and Phnom Penh, this is not part
12684616d0f9Sopenharmony_ciof the stable interface and the timezone can split at any time.
12694616d0f9Sopenharmony_ciIf a calendar application records a future event in some location other
12704616d0f9Sopenharmony_cithan Bangkok by putting "<samp>Asia/Bangkok</samp>" in the event's record,
12714616d0f9Sopenharmony_cithe application should be robust in the presence of timezone splits
12724616d0f9Sopenharmony_cibetween now and the future time.
12734616d0f9Sopenharmony_ci</p>
12744616d0f9Sopenharmony_ci</section>
12754616d0f9Sopenharmony_ci
12764616d0f9Sopenharmony_ci<section>
12774616d0f9Sopenharmony_ci  <h2 id="leapsec">Leap seconds</h2>
12784616d0f9Sopenharmony_ci<p>
12794616d0f9Sopenharmony_ciLeap seconds were introduced in 1972 to accommodate the
12804616d0f9Sopenharmony_cidifference between atomic time and the less regular rotation of the earth.
12814616d0f9Sopenharmony_ciUnfortunately they caused so many problems with civil
12824616d0f9Sopenharmony_citimekeeping that they
12834616d0f9Sopenharmony_ciare <a href="https://www.bipm.org/en/cgpm-2022/resolution-4">planned
12844616d0f9Sopenharmony_cito be discontinued by 2035</a>, with some as-yet-undetermined
12854616d0f9Sopenharmony_cimechanism replacing them, perhaps after the year 2135.
12864616d0f9Sopenharmony_ciDespite their impending obsolescence, a record of leap seconds is still
12874616d0f9Sopenharmony_cineeded to resolve timestamps from 1972 through 2035.
12884616d0f9Sopenharmony_ci</p>
12894616d0f9Sopenharmony_ci
12904616d0f9Sopenharmony_ci<p>
12914616d0f9Sopenharmony_ciThe <code><abbr>tz</abbr></code> code and data can account for leap seconds,
12924616d0f9Sopenharmony_cithanks to code contributed by Bradley White.
12934616d0f9Sopenharmony_ciHowever, the leap second support of this package is rarely used directly
12944616d0f9Sopenharmony_cibecause POSIX requires leap seconds to be excluded and many
12954616d0f9Sopenharmony_cisoftware packages would mishandle leap seconds if they were present.
12964616d0f9Sopenharmony_ciInstead, leap seconds are more commonly handled by occasionally adjusting
12974616d0f9Sopenharmony_cithe operating system kernel clock as described in
12984616d0f9Sopenharmony_ci<a href="tz-link.html#precision">Precision timekeeping</a>,
12994616d0f9Sopenharmony_ciand this package by default installs a <samp>leapseconds</samp> file
13004616d0f9Sopenharmony_cicommonly used by
13014616d0f9Sopenharmony_ci<a href="https://www.ntp.org"><abbr title="Network Time Protocol">NTP</abbr></a>
13024616d0f9Sopenharmony_cisoftware that adjusts the kernel clock.
13034616d0f9Sopenharmony_ciHowever, kernel-clock twiddling approximates UTC only roughly,
13044616d0f9Sopenharmony_ciand systems needing more precise UTC can use this package's leap
13054616d0f9Sopenharmony_cisecond support directly.
13064616d0f9Sopenharmony_ci</p>
13074616d0f9Sopenharmony_ci
13084616d0f9Sopenharmony_ci<p>
13094616d0f9Sopenharmony_ciThe directly supported mechanism assumes that <code>time_t</code>
13104616d0f9Sopenharmony_cicounts of seconds since the POSIX epoch normally include leap seconds,
13114616d0f9Sopenharmony_cias opposed to POSIX <code>time_t</code> counts which exclude leap seconds.
13124616d0f9Sopenharmony_ciThis modified timescale is converted to <abbr>UTC</abbr>
13134616d0f9Sopenharmony_ciat the same point that time zone and <abbr>DST</abbr>
13144616d0f9Sopenharmony_ciadjustments are applied &ndash;
13154616d0f9Sopenharmony_cinamely, at calls to <code>localtime</code> and analogous functions &ndash;
13164616d0f9Sopenharmony_ciand the process is driven by leap second information
13174616d0f9Sopenharmony_cistored in alternate versions of the <abbr>TZif</abbr> files.
13184616d0f9Sopenharmony_ciBecause a leap second adjustment may be needed even
13194616d0f9Sopenharmony_ciif no time zone correction is desired,
13204616d0f9Sopenharmony_cicalls to <code>gmtime</code>-like functions
13214616d0f9Sopenharmony_cialso need to consult a <abbr>TZif</abbr> file,
13224616d0f9Sopenharmony_ciconventionally named <samp><abbr>Etc/UTC</abbr></samp>
13234616d0f9Sopenharmony_ci(<samp><abbr>GMT</abbr></samp> in previous versions),
13244616d0f9Sopenharmony_cito see whether leap second corrections are needed.
13254616d0f9Sopenharmony_ciTo convert an application's <code>time_t</code> timestamps to or from
13264616d0f9Sopenharmony_ciPOSIX <code>time_t</code> timestamps (for use when, say,
13274616d0f9Sopenharmony_ciembedding or interpreting timestamps in portable
13284616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Tar_(computing)"><code>tar</code></a>
13294616d0f9Sopenharmony_cifiles),
13304616d0f9Sopenharmony_cithe application can call the utility functions
13314616d0f9Sopenharmony_ci<code>time2posix</code> and <code>posix2time</code>
13324616d0f9Sopenharmony_ciincluded with this package.
13334616d0f9Sopenharmony_ci</p>
13344616d0f9Sopenharmony_ci
13354616d0f9Sopenharmony_ci<p>
13364616d0f9Sopenharmony_ciIf the POSIX-compatible <abbr>TZif</abbr> file set is installed
13374616d0f9Sopenharmony_ciin a directory whose basename is <samp>zoneinfo</samp>, the
13384616d0f9Sopenharmony_cileap-second-aware file set is by default installed in a separate
13394616d0f9Sopenharmony_cidirectory <samp>zoneinfo-leaps</samp>.
13404616d0f9Sopenharmony_ciAlthough each process can have its own time zone by setting
13414616d0f9Sopenharmony_ciits <code>TZ</code> environment variable, there is no support for some
13424616d0f9Sopenharmony_ciprocesses being leap-second aware while other processes are
13434616d0f9Sopenharmony_ciPOSIX-compatible; the leap-second choice is system-wide.
13444616d0f9Sopenharmony_ciSo if you configure your kernel to count leap seconds, you should also
13454616d0f9Sopenharmony_cidiscard <samp>zoneinfo</samp> and rename <samp>zoneinfo-leaps</samp>
13464616d0f9Sopenharmony_cito <samp>zoneinfo</samp>.
13474616d0f9Sopenharmony_ciAlternatively, you can install just one set of <abbr>TZif</abbr> files
13484616d0f9Sopenharmony_ciin the first place; see the <code>REDO</code> variable in this package's
13494616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Makefile">makefile</a>.
13504616d0f9Sopenharmony_ci</p>
13514616d0f9Sopenharmony_ci</section>
13524616d0f9Sopenharmony_ci
13534616d0f9Sopenharmony_ci<section>
13544616d0f9Sopenharmony_ci  <h2 id="calendar">Calendrical issues</h2>
13554616d0f9Sopenharmony_ci<p>
13564616d0f9Sopenharmony_ciCalendrical issues are a bit out of scope for a time zone database,
13574616d0f9Sopenharmony_cibut they indicate the sort of problems that we would run into if we
13584616d0f9Sopenharmony_ciextended the time zone database further into the past.
13594616d0f9Sopenharmony_ciAn excellent resource in this area is Edward M. Reingold
13604616d0f9Sopenharmony_ciand Nachum Dershowitz, <cite><a
13614616d0f9Sopenharmony_cihref="https://www.cambridge.org/fr/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition">Calendrical
13624616d0f9Sopenharmony_ciCalculations: The Ultimate Edition</a></cite>, Cambridge University Press (2018).
13634616d0f9Sopenharmony_ciOther information and sources are given in the file '<code>calendars</code>'
13644616d0f9Sopenharmony_ciin the <code><abbr>tz</abbr></code> distribution.
13654616d0f9Sopenharmony_ciThey sometimes disagree.
13664616d0f9Sopenharmony_ci</p>
13674616d0f9Sopenharmony_ci</section>
13684616d0f9Sopenharmony_ci
13694616d0f9Sopenharmony_ci<section>
13704616d0f9Sopenharmony_ci  <h2 id="planets">Time and time zones off Earth</h2>
13714616d0f9Sopenharmony_ci<p>
13724616d0f9Sopenharmony_ciThe European Space Agency is <a
13734616d0f9Sopenharmony_cihref='https://www.esa.int/Applications/Navigation/Telling_time_on_the_Moon'>considering</a>
13744616d0f9Sopenharmony_cithe establishment of a reference timescale for the Moon, which has
13754616d0f9Sopenharmony_cidays roughly equivalent to 29.5 Earth days, and where relativistic
13764616d0f9Sopenharmony_cieffects cause clocks to tick slightly faster than on Earth.
13774616d0f9Sopenharmony_ci</p>
13784616d0f9Sopenharmony_ci
13794616d0f9Sopenharmony_ci<p>
13804616d0f9Sopenharmony_ciSome people's work schedules have used
13814616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Timekeeping_on_Mars">Mars time</a>.
13824616d0f9Sopenharmony_ciJet Propulsion Laboratory (JPL) coordinators kept Mars time on
13834616d0f9Sopenharmony_ciand off during the
13844616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Mars_Pathfinder">Mars
13854616d0f9Sopenharmony_ciPathfinder</a> mission (1997).
13864616d0f9Sopenharmony_ciSome of their family members also adapted to Mars time.
13874616d0f9Sopenharmony_ciDozens of special Mars watches were built for JPL workers who kept
13884616d0f9Sopenharmony_ciMars time during the
13894616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Mars_Exploration_Rover">Mars
13904616d0f9Sopenharmony_ciExploration Rovers (MER)</a> mission (2004&ndash;2018).
13914616d0f9Sopenharmony_ciThese timepieces looked like normal Seikos and Citizens but were adjusted
13924616d0f9Sopenharmony_cito use Mars seconds rather than terrestrial seconds, although
13934616d0f9Sopenharmony_ciunfortunately the adjusted watches were unreliable and appear to have
13944616d0f9Sopenharmony_cihad only limited use.
13954616d0f9Sopenharmony_ci</p>
13964616d0f9Sopenharmony_ci
13974616d0f9Sopenharmony_ci<p>
13984616d0f9Sopenharmony_ciA Mars solar day is called a "sol" and has a mean period equal to
13994616d0f9Sopenharmony_ciabout 24 hours 39 minutes 35.244 seconds in terrestrial time.
14004616d0f9Sopenharmony_ciIt is divided into a conventional 24-hour clock, so each Mars second
14014616d0f9Sopenharmony_ciequals about 1.02749125 terrestrial seconds.
14024616d0f9Sopenharmony_ci(One MER worker noted, "If I am working Mars hours, and Mars hours are
14034616d0f9Sopenharmony_ci2.5% more than Earth hours, shouldn't I get an extra 2.5% pay raise?")
14044616d0f9Sopenharmony_ci</p>
14054616d0f9Sopenharmony_ci
14064616d0f9Sopenharmony_ci<p>
14074616d0f9Sopenharmony_ciThe <a href="https://en.wikipedia.org/wiki/Prime_meridian">prime
14084616d0f9Sopenharmony_cimeridian</a> of Mars goes through the center of the crater
14094616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Airy-0">Airy-0</a>, named in
14104616d0f9Sopenharmony_cihonor of the British astronomer who built the Greenwich telescope that
14114616d0f9Sopenharmony_cidefines Earth's prime meridian.
14124616d0f9Sopenharmony_ciMean solar time on the Mars prime meridian is
14134616d0f9Sopenharmony_cicalled Mars Coordinated Time (<abbr>MTC</abbr>).
14144616d0f9Sopenharmony_ci</p>
14154616d0f9Sopenharmony_ci
14164616d0f9Sopenharmony_ci<p>
14174616d0f9Sopenharmony_ciEach landed mission on Mars has adopted a different reference for
14184616d0f9Sopenharmony_cisolar timekeeping, so there is no real standard for Mars time zones.
14194616d0f9Sopenharmony_ciFor example, the MER mission defined two time zones "Local
14204616d0f9Sopenharmony_ciSolar Time A" and "Local Solar Time B" for its two missions, each zone
14214616d0f9Sopenharmony_cidesigned so that its time equals local true solar time at
14224616d0f9Sopenharmony_ciapproximately the middle of the nominal mission.
14234616d0f9Sopenharmony_ciThe A and B zones differ enough so that an MER worker assigned to
14244616d0f9Sopenharmony_cithe A zone might suffer "Mars lag" when switching to work in the B zone.
14254616d0f9Sopenharmony_ciSuch a "time zone" is not particularly suited for any application
14264616d0f9Sopenharmony_ciother than the mission itself.
14274616d0f9Sopenharmony_ci</p>
14284616d0f9Sopenharmony_ci
14294616d0f9Sopenharmony_ci<p>
14304616d0f9Sopenharmony_ciMany calendars have been proposed for Mars, but none have achieved
14314616d0f9Sopenharmony_ciwide acceptance.
14324616d0f9Sopenharmony_ciAstronomers often use Mars Sol Date (<abbr>MSD</abbr>) which is a
14334616d0f9Sopenharmony_cisequential count of Mars solar days elapsed since about 1873-12-29
14344616d0f9Sopenharmony_ci12:00 <abbr>GMT</abbr>.
14354616d0f9Sopenharmony_ci</p>
14364616d0f9Sopenharmony_ci
14374616d0f9Sopenharmony_ci<p>
14384616d0f9Sopenharmony_ciIn our solar system, Mars is the planet with time and calendar most
14394616d0f9Sopenharmony_cilike Earth's.
14404616d0f9Sopenharmony_ciOn other planets, Sun-based time and calendars would work quite
14414616d0f9Sopenharmony_cidifferently.
14424616d0f9Sopenharmony_ciFor example, although Mercury's
14434616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Rotation_period">sidereal
14444616d0f9Sopenharmony_cirotation period</a> is 58.646 Earth days, Mercury revolves around the
14454616d0f9Sopenharmony_ciSun so rapidly that an observer on Mercury's equator would see a
14464616d0f9Sopenharmony_cisunrise only every 175.97 Earth days, i.e., a Mercury year is 0.5 of a
14474616d0f9Sopenharmony_ciMercury day.
14484616d0f9Sopenharmony_ciVenus is more complicated, partly because its rotation is slightly
14494616d0f9Sopenharmony_ci<a href="https://en.wikipedia.org/wiki/Retrograde_motion">retrograde</a>:
14504616d0f9Sopenharmony_ciits year is 1.92 of its days.
14514616d0f9Sopenharmony_ciGas giants like Jupiter are trickier still, as their polar and
14524616d0f9Sopenharmony_ciequatorial regions rotate at different rates, so that the length of a
14534616d0f9Sopenharmony_ciday depends on latitude.
14544616d0f9Sopenharmony_ciThis effect is most pronounced on Neptune, where the day is about 12
14554616d0f9Sopenharmony_cihours at the poles and 18 hours at the equator.
14564616d0f9Sopenharmony_ci</p>
14574616d0f9Sopenharmony_ci
14584616d0f9Sopenharmony_ci<p>
14594616d0f9Sopenharmony_ciAlthough the <code><abbr>tz</abbr></code> database does not support
14604616d0f9Sopenharmony_citime on other planets, it is documented here in the hopes that support
14614616d0f9Sopenharmony_ciwill be added eventually.
14624616d0f9Sopenharmony_ci</p>
14634616d0f9Sopenharmony_ci
14644616d0f9Sopenharmony_ci<p>
14654616d0f9Sopenharmony_ciSources for time on other planets:
14664616d0f9Sopenharmony_ci</p>
14674616d0f9Sopenharmony_ci
14684616d0f9Sopenharmony_ci<ul>
14694616d0f9Sopenharmony_ci  <li>
14704616d0f9Sopenharmony_ci    Michael Allison and Robert Schmunk,
14714616d0f9Sopenharmony_ci    "<a href="https://www.giss.nasa.gov/tools/mars24/help/notes.html">Technical
14724616d0f9Sopenharmony_ci      Notes on Mars Solar Time as Adopted by the Mars24 Sunclock</a>"
14734616d0f9Sopenharmony_ci    (2020-03-08).
14744616d0f9Sopenharmony_ci  </li>
14754616d0f9Sopenharmony_ci  <li>
14764616d0f9Sopenharmony_ci    Zara Mirmalek,
14774616d0f9Sopenharmony_ci    <em><a href="https://mitpress.mit.edu/books/making-time-mars">Making
14784616d0f9Sopenharmony_ci	Time on Mars</a></em>, MIT Press (March 2020), ISBN 978-0262043854.
14794616d0f9Sopenharmony_ci  </li>
14804616d0f9Sopenharmony_ci  <li>
14814616d0f9Sopenharmony_ci    Jia-Rui Chong,
14824616d0f9Sopenharmony_ci    "<a href="https://www.latimes.com/archives/la-xpm-2004-jan-14-sci-marstime14-story.html">Workdays
14834616d0f9Sopenharmony_ci    Fit for a Martian</a>", <cite>Los Angeles Times</cite>
14844616d0f9Sopenharmony_ci    (2004-01-14), pp A1, A20&ndash;A21.
14854616d0f9Sopenharmony_ci  </li>
14864616d0f9Sopenharmony_ci  <li>
14874616d0f9Sopenharmony_ci    Tom Chmielewski,
14884616d0f9Sopenharmony_ci    "<a href="https://www.theatlantic.com/technology/archive/2015/02/jet-lag-is-worse-on-mars/386033/">Jet
14894616d0f9Sopenharmony_ci    Lag Is Worse on Mars</a>", <cite>The Atlantic</cite> (2015-02-26)
14904616d0f9Sopenharmony_ci  </li>
14914616d0f9Sopenharmony_ci  <li>
14924616d0f9Sopenharmony_ci    Matt Williams,
14934616d0f9Sopenharmony_ci    "<a href="https://www.universetoday.com/37481/days-of-the-planets/">How
14944616d0f9Sopenharmony_ci    long is a day on the other planets of the solar system?</a>"
14954616d0f9Sopenharmony_ci    (2016-01-20).
14964616d0f9Sopenharmony_ci  </li>
14974616d0f9Sopenharmony_ci</ul>
14984616d0f9Sopenharmony_ci</section>
14994616d0f9Sopenharmony_ci
15004616d0f9Sopenharmony_ci<footer>
15014616d0f9Sopenharmony_ci  <hr>
15024616d0f9Sopenharmony_ci  This file is in the public domain, so clarified as of 2009-05-17 by
15034616d0f9Sopenharmony_ci  Arthur David Olson.
15044616d0f9Sopenharmony_ci</footer>
15054616d0f9Sopenharmony_ci</body>
15064616d0f9Sopenharmony_ci</html>
1507