Home | History | Annotate | Line # | Download | only in time
tz-how-to.html revision 1.9
      1  1.8  christos <!DOCTYPE html>
      2  1.8  christos <html lang="en">
      3  1.3  christos <head>
      4  1.3  christos <title>How to Read the tz Database</title>
      5  1.8  christos <meta charset="UTF-8">
      6  1.8  christos <style>
      7  1.5  christos pre {margin-left: 2em; white-space: pre-wrap;}
      8  1.8  christos pre.td {margin-left: 0;}
      9  1.8  christos td {text-align: center;}
     10  1.8  christos table {border: 1px outset;}
     11  1.8  christos th, td {border: 1px inset;}
     12  1.8  christos table.rule {border: none; margin: auto;}
     13  1.8  christos td.footnote {text-align: left;}
     14  1.5  christos </style>
     15  1.3  christos </head>
     16  1.1  christos <body>
     17  1.1  christos <h2>How to Read the <a href="https://en.wikipedia.org/wiki/Tz_database">tz
     18  1.1  christos Database</a> Source Files</h2>
     19  1.1  christos <h3>by Bill Seymour</h3>
     20  1.9  christos <p>This guide uses the <code>America/Chicago</code> and
     21  1.1  christos <code>Pacific/Honolulu</code> zones as examples of how to infer
     22  1.4  christos times of day from the <a href="tz-link.html">tz database</a>
     23  1.1  christos source files. It might be helpful, but not absolutely necessary,
     24  1.1  christos for the reader to have already downloaded the
     25  1.2  christos latest release of the database and become familiar with the basic layout
     26  1.1  christos of the data files. The format is explained in the &ldquo;man
     27  1.1  christos page&rdquo; for the zic compiler, <code>zic.8.txt</code>, in
     28  1.9  christos the <code>code</code> subdirectory.
     29  1.9  christos Although this guide covers many of the common cases, it is not a
     30  1.9  christos complete summary of what zic accepts; the man page is the
     31  1.9  christos authoritative reference.</p>
     32  1.1  christos 
     33  1.1  christos <p>We&rsquo;ll begin by talking about the rules for changing between standard
     34  1.1  christos and daylight saving time since we&rsquo;ll need that information when we talk
     35  1.1  christos about the zones.</p>
     36  1.1  christos 
     37  1.1  christos <p>First, let&rsquo;s consider the special daylight saving time rules
     38  1.1  christos for Chicago (from the <code>northamerica</code> file in
     39  1.1  christos the <code>data</code> subdirectory):</p>
     40  1.1  christos 
     41  1.8  christos <table>
     42  1.1  christos <tr>
     43  1.1  christos   <th colspan="6">From the Source File</th>
     44  1.1  christos </tr>
     45  1.1  christos <tr>
     46  1.8  christos   <td colspan="6">
     47  1.8  christos     <table class="rule">
     48  1.8  christos       <tr><td style="border:none;text-align:left">
     49  1.8  christos <pre class="td">
     50  1.8  christos #Rule NAME    FROM TO    -   IN  ON      AT   SAVE LETTER
     51  1.1  christos Rule  Chicago 1920 only  -   Jun 13      2:00 1:00 D
     52  1.1  christos Rule  Chicago 1920 1921  -   Oct lastSun 2:00 0    S
     53  1.1  christos Rule  Chicago 1921 only  -   Mar lastSun 2:00 1:00 D
     54  1.1  christos Rule  Chicago 1922 1966  -   Apr lastSun 2:00 1:00 D
     55  1.1  christos Rule  Chicago 1922 1954  -   Sep lastSun 2:00 0    S
     56  1.1  christos Rule  Chicago 1955 1966  -   Oct lastSun 2:00 0    S
     57  1.1  christos </pre>
     58  1.1  christos   </td></tr></table></td>
     59  1.1  christos </tr>
     60  1.1  christos <tr>
     61  1.1  christos   <th colspan="6">Reformatted a Bit</th>
     62  1.1  christos </tr>
     63  1.1  christos <tr>
     64  1.1  christos   <th>From</th>
     65  1.1  christos   <th>To</th>
     66  1.1  christos   <th colspan="2">On</th>
     67  1.1  christos   <th>At</th>
     68  1.1  christos   <th>Action</th>
     69  1.1  christos </tr>
     70  1.8  christos <tr>
     71  1.1  christos   <td colspan="2">1920 only</td>
     72  1.1  christos   <td colspan="2">June 13<small><sup>th</sup></small></td>
     73  1.1  christos   <td rowspan="6">02:00 local</td>
     74  1.1  christos   <td>go to daylight saving time</td>
     75  1.1  christos </tr>
     76  1.8  christos <tr>
     77  1.1  christos   <td>1920</td>
     78  1.1  christos   <td>1921</td>
     79  1.1  christos   <td rowspan="5">last Sunday</td>
     80  1.1  christos   <td>in October</td>
     81  1.1  christos   <td>return to standard time</td>
     82  1.1  christos </tr>
     83  1.8  christos <tr>
     84  1.1  christos   <td colspan="2">1921 only</td>
     85  1.1  christos   <td>in March</td>
     86  1.1  christos   <td rowspan="2">go to daylight saving time</td>
     87  1.1  christos </tr>
     88  1.8  christos <tr>
     89  1.1  christos   <td rowspan="2">1922</td>
     90  1.1  christos   <td>1966</td>
     91  1.1  christos   <td>in April</td>
     92  1.1  christos </tr>
     93  1.8  christos <tr>
     94  1.1  christos   <td>1954</td>
     95  1.1  christos   <td>in September</td>
     96  1.1  christos   <td rowspan="2">return to standard time</td>
     97  1.1  christos </tr>
     98  1.8  christos <tr>
     99  1.1  christos   <td>1955</td>
    100  1.1  christos   <td>1966</td>
    101  1.1  christos   <td>in October</td>
    102  1.1  christos </tr>
    103  1.1  christos </table>
    104  1.1  christos 
    105  1.8  christos <p>The <code>FROM</code> and <code>TO</code> columns, respectively, specify the
    106  1.8  christos first and last calendar years defining a contiguous range over which a specific
    107  1.8  christos Rule line is to apply.  The keyword <code>only</code> can be used in the
    108  1.8  christos <code>TO</code> field to repeat the value of the <code>FROM</code> field in the
    109  1.8  christos event that a rule should only apply to a single year.  Often, the keyword
    110  1.8  christos <code>max</code> is used to extend a rule&rsquo;s application into the
    111  1.8  christos indefinite future; it is a platform-agnostic stand-in for the largest
    112  1.8  christos representable year.
    113  1.8  christos 
    114  1.8  christos <p>The next column, <code>-</code>, is reserved; for compatibility with earlier
    115  1.8  christos releases, it always contains a hyphen, which acts as a kind of null value.
    116  1.8  christos Prior to the 2020b release, it was called the <code>TYPE</code> field, though
    117  1.9  christos it had not been used in the main data since the 2000e release.
    118  1.9  christos An obsolescent supplementary file used the
    119  1.8  christos field as a proof-of-concept to allow <code>zic</code> to apply a given Rule
    120  1.8  christos line only to certain &ldquo;types&rdquo; of years within the specified range as
    121  1.8  christos dictated by the output of a separate script, such as: only years which would
    122  1.8  christos have a US presidential election, or only years which wouldn&rsquo;t.
    123  1.1  christos 
    124  1.7  christos <p>The <code>SAVE</code> column contains the local (wall clock) offset from
    125  1.1  christos local standard time.
    126  1.1  christos This is usually either zero for standard time or one hour for daylight
    127  1.1  christos saving time; but there&rsquo;s no reason, in principle, why it can&rsquo;t
    128  1.1  christos take on other values.
    129  1.1  christos 
    130  1.1  christos <p>The <code>LETTER</code> (sometimes called <code>LETTER/S</code>)
    131  1.1  christos column can contain a variable
    132  1.1  christos part of the usual abbreviation of the time zone&rsquo;s name, or it can just
    133  1.1  christos be a hyphen if there&rsquo;s no variable part. For example, the abbreviation
    134  1.1  christos used in the central time zone will be either &ldquo;CST&rdquo; or
    135  1.1  christos &ldquo;CDT&rdquo;. The variable part is &lsquo;S&rsquo; or &lsquo;D&rsquo;;
    136  1.1  christos and, sure enough, that&rsquo;s just what we find in
    137  1.1  christos the <code>LETTER</code> column
    138  1.1  christos in the <code>Chicago</code> rules. More about this when we talk about
    139  1.1  christos &ldquo;Zone&rdquo; lines.
    140  1.1  christos 
    141  1.1  christos <p>One important thing to notice is that &ldquo;Rule&rdquo; lines
    142  1.1  christos want at once to be both <i>transitions</i> and <i>steady states</i>:
    143  1.1  christos <ul>
    144  1.1  christos <li>On the one hand, they represent transitions between standard and
    145  1.1  christos daylight saving time; and any number of Rule lines can be in effect
    146  1.1  christos during a given period (which will always be a non-empty set of
    147  1.1  christos contiguous calendar years).</li>
    148  1.1  christos <li>On the other hand, the <code>SAVE</code> and <code>LETTER</code>
    149  1.1  christos columns contain state that exists between transitions. More about this
    150  1.1  christos when we talk about the US rules.</li>
    151  1.1  christos </ul>
    152  1.1  christos 
    153  1.1  christos <p>In the example above, the transition to daylight saving time
    154  1.1  christos happened on the 13<small><sup>th</sup></small> of June in 1920, and on
    155  1.1  christos the last Sunday in March in 1921; but the return to standard time
    156  1.1  christos happened on the last Sunday in October in both of those
    157  1.1  christos years. Similarly, the rule for changing to daylight saving time was
    158  1.1  christos the same from 1922 to 1966; but the rule for returning to standard
    159  1.1  christos time changed in 1955. Got it?</p>
    160  1.1  christos 
    161  1.1  christos <p>OK, now for the somewhat more interesting &ldquo;US&rdquo; rules:</p>
    162  1.1  christos 
    163  1.8  christos <table>
    164  1.1  christos <tr>
    165  1.1  christos   <th colspan="6">From the Source File</th>
    166  1.1  christos </tr>
    167  1.1  christos <tr>
    168  1.8  christos   <td colspan="6">
    169  1.8  christos     <table class="rule">
    170  1.8  christos       <tr><td style="border:none;text-align:left">
    171  1.8  christos <pre class="td">
    172  1.8  christos #Rule NAME FROM TO    -   IN  ON        AT   SAVE LETTER/S
    173  1.1  christos Rule  US   1918 1919  -   Mar lastSun  2:00  1:00 D
    174  1.1  christos Rule  US   1918 1919  -   Oct lastSun  2:00  0    S
    175  1.1  christos Rule  US   1942 only  -   Feb 9        2:00  1:00 W # War
    176  1.1  christos Rule  US   1945 only  -   Aug 14      23:00u 1:00 P # Peace
    177  1.1  christos Rule  US   1945 only  -   Sep 30       2:00  0    S
    178  1.1  christos Rule  US   1967 2006  -   Oct lastSun  2:00  0    S
    179  1.1  christos Rule  US   1967 1973  -   Apr lastSun  2:00  1:00 D
    180  1.1  christos Rule  US   1974 only  -   Jan 6        2:00  1:00 D
    181  1.1  christos Rule  US   1975 only  -   Feb 23       2:00  1:00 D
    182  1.1  christos Rule  US   1976 1986  -   Apr lastSun  2:00  1:00 D
    183  1.1  christos Rule  US   1987 2006  -   Apr Sun&gt;=1   2:00  1:00 D
    184  1.1  christos Rule  US   2007 max   -   Mar Sun&gt;=8   2:00  1:00 D
    185  1.1  christos Rule  US   2007 max   -   Nov Sun&gt;=1   2:00  0    S
    186  1.1  christos </pre>
    187  1.1  christos   </td></tr></table></td>
    188  1.1  christos </tr>
    189  1.1  christos <tr>
    190  1.1  christos   <th colspan="6">Reformatted a Bit</th>
    191  1.1  christos </tr>
    192  1.1  christos <tr>
    193  1.1  christos   <th>From</th>
    194  1.1  christos   <th>To</th>
    195  1.1  christos   <th colspan="2">On</th>
    196  1.1  christos   <th>At</th>
    197  1.1  christos   <th>Action</th>
    198  1.1  christos </tr>
    199  1.8  christos <tr>
    200  1.1  christos   <td rowspan="2">1918</td>
    201  1.1  christos   <td rowspan="2">1919</td>
    202  1.1  christos   <td rowspan="2">last Sunday</td>
    203  1.1  christos   <td>in March</td>
    204  1.1  christos   <td rowspan="3">02:00 local</td>
    205  1.1  christos   <td>go to daylight saving time</td>
    206  1.1  christos </tr>
    207  1.8  christos <tr>
    208  1.1  christos   <td>in October</td>
    209  1.1  christos   <td>return to standard time</td>
    210  1.1  christos </tr>
    211  1.8  christos <tr>
    212  1.1  christos   <td colspan="2">1942 only</td>
    213  1.1  christos   <td colspan="2">February 9<small><sup>th</sup></small></td>
    214  1.1  christos   <td>go to &ldquo;war time&rdquo;</td>
    215  1.1  christos </tr>
    216  1.8  christos <tr>
    217  1.1  christos   <td colspan="2" rowspan="2">1945 only</td>
    218  1.1  christos   <td colspan="2">August 14<small><sup>th</sup></small></td>
    219  1.1  christos   <td>23:00 <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a></td>
    220  1.1  christos   <td>
    221  1.1  christos     rename &ldquo;war time&rdquo; to &ldquo;peace<br>time;&rdquo;
    222  1.1  christos     clocks don&rsquo;t change
    223  1.1  christos   </td>
    224  1.1  christos </tr>
    225  1.8  christos <tr>
    226  1.1  christos   <td colspan="2">September 30<small><sup>th</sup></small></td>
    227  1.1  christos   <td rowspan="9">02:00 local</td>
    228  1.1  christos   <td rowspan="2">return to standard time</td>
    229  1.1  christos </tr>
    230  1.8  christos <tr>
    231  1.1  christos   <td rowspan="2">1967</td>
    232  1.1  christos   <td>2006</td>
    233  1.1  christos   <td rowspan="2">last Sunday</td>
    234  1.1  christos   <td>in October</td>
    235  1.1  christos </tr>
    236  1.8  christos <tr>
    237  1.1  christos   <td>1973</td>
    238  1.1  christos   <td>in April</td>
    239  1.1  christos   <td rowspan="6">go to daylight saving time</td>
    240  1.1  christos </tr>
    241  1.8  christos <tr>
    242  1.1  christos   <td colspan="2">1974 only</td>
    243  1.1  christos   <td colspan="2">January 6<small><sup>th</sup></small></td>
    244  1.1  christos </tr>
    245  1.8  christos <tr>
    246  1.1  christos   <td colspan="2">1975 only</td>
    247  1.1  christos   <td colspan="2">February 23<small><sup>rd</sup></small></td>
    248  1.1  christos </tr>
    249  1.8  christos <tr>
    250  1.1  christos   <td>1976</td>
    251  1.1  christos   <td>1986</td>
    252  1.1  christos   <td>last Sunday</td>
    253  1.1  christos   <td rowspan="2">in April</td>
    254  1.1  christos </tr>
    255  1.8  christos <tr>
    256  1.1  christos   <td>1987</td>
    257  1.1  christos   <td>2006</td>
    258  1.1  christos   <td>first Sunday</td>
    259  1.1  christos </tr>
    260  1.8  christos <tr>
    261  1.1  christos   <td rowspan="2">2007</td>
    262  1.1  christos   <td rowspan="2">present</td>
    263  1.1  christos   <td colspan="2">second Sunday in March</td>
    264  1.1  christos </tr>
    265  1.8  christos <tr>
    266  1.1  christos   <td colspan="2">first Sunday in November</td>
    267  1.1  christos   <td>return to standard time</td>
    268  1.1  christos </tr>
    269  1.1  christos </table>
    270  1.1  christos 
    271  1.1  christos <p>There are two interesting things to note here.</p>
    272  1.1  christos 
    273  1.1  christos <p>First, the time that something happens (in the <code>AT</code>
    274  1.7  christos column) is not necessarily the local (wall clock) time. The time can be
    275  1.1  christos suffixed with &lsquo;s&rsquo; (for &ldquo;standard&rdquo;) to mean
    276  1.7  christos local standard time, different from local (wall clock) time when observing
    277  1.7  christos daylight saving time; or it can be suffixed with &lsquo;g&rsquo;,
    278  1.1  christos &lsquo;u&rsquo;, or &lsquo;z&rsquo;, all three of which mean the
    279  1.1  christos standard time at the
    280  1.2  christos <a href="https://en.wikipedia.org/wiki/Prime_Meridian">prime meridian</a>.
    281  1.1  christos &lsquo;g&rsquo; stands for &ldquo;<a
    282  1.1  christos href="https://en.wikipedia.org/wiki/Greenwich_Mean_Time">GMT</a>&rdquo;;
    283  1.1  christos &lsquo;u&rsquo; stands for &ldquo;<a
    284  1.1  christos href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>&rdquo; or &ldquo;<a
    285  1.1  christos href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>&rdquo;
    286  1.1  christos (whichever was official at the time); &lsquo;z&rsquo; stands for the
    287  1.1  christos <a href="https://en.wikipedia.org/wiki/Nautical_time">nautical time zone</a>
    288  1.1  christos Z (a.k.a. &ldquo;Zulu&rdquo; which, in turn, stands for &lsquo;Z&rsquo;).
    289  1.7  christos The time can also be suffixed with &lsquo;w&rsquo; meaning local (wall
    290  1.7  christos clock) time; but it usually isn&rsquo;t because that&rsquo;s the
    291  1.1  christos default.</p>
    292  1.1  christos 
    293  1.1  christos <p>Second, the day in the <code>ON</code> column, in addition to
    294  1.1  christos &ldquo;<code>lastSun</code>&rdquo; or a particular day of the month,
    295  1.1  christos can have the form, &ldquo;<code>Sun&gt;=</code><i>x</i>&rdquo; or
    296  1.1  christos &ldquo;<code>Sun&lt;=</code><i>x</i>,&rdquo; where <i>x</i> is a day
    297  1.1  christos of the month. For example, &ldquo;<code>Sun&gt;=8</code>&rdquo; means
    298  1.1  christos &ldquo;the first Sunday on or after the eighth of the month,&rdquo; in
    299  1.1  christos other words, the second Sunday of the month. Furthermore, although
    300  1.1  christos there are no examples above, the weekday needn&rsquo;t be
    301  1.1  christos &ldquo;<code>Sun</code>&rdquo; in either form, but can be the usual
    302  1.1  christos three-character English abbreviation for any day of the week.</p>
    303  1.1  christos 
    304  1.1  christos <p>And the US rules give us more examples of a couple of things
    305  1.1  christos already mentioned:</p>
    306  1.1  christos 
    307  1.1  christos <ul>
    308  1.1  christos <li>The rules for changing to and from daylight saving time are
    309  1.1  christos actually <i>different sets</i> of rules; and the two sets can change
    310  1.1  christos independently. Consider, for example, that the rule for the return to
    311  1.1  christos standard time stayed the same from 1967 to 2006; but the rule for the
    312  1.1  christos transition to daylight saving time changed several times in the same
    313  1.1  christos period.  There can also be periods, 1946 to 1966 for example, when no
    314  1.1  christos rule from this group is in effect, and so either no transition
    315  1.1  christos happened in those years, or some other rule is in effect (perhaps a
    316  1.1  christos state or other more local rule).</li>
    317  1.1  christos 
    318  1.1  christos <li>The <code>SAVE</code> and <code>LETTER</code> columns
    319  1.1  christos contain <i>steady state</i>, not transitions. Consider, for example,
    320  1.1  christos the transition from &ldquo;war time&rdquo; to &ldquo;peace time&rdquo;
    321  1.1  christos that happened on August 14, 1945. The &ldquo;1:00&rdquo; in
    322  1.1  christos the <code>SAVE</code> column is <i>not</i> an instruction to advance
    323  1.1  christos the clock an hour. It means that clocks should <i>be</i> one hour
    324  1.1  christos ahead of standard time, which they already are because of the previous
    325  1.1  christos rule, so there should be no change.</li>
    326  1.1  christos 
    327  1.1  christos </ul>
    328  1.1  christos 
    329  1.1  christos <p>OK, now let&rsquo;s look at a Zone record:</p>
    330  1.1  christos 
    331  1.8  christos <table>
    332  1.1  christos <tr>
    333  1.1  christos   <th colspan="5">From the Source File</th>
    334  1.1  christos </tr>
    335  1.1  christos <tr>
    336  1.8  christos   <td colspan="5">
    337  1.8  christos     <table class="rule">
    338  1.8  christos       <tr><td style="border:none;text-align:left">
    339  1.8  christos <pre class="td">
    340  1.7  christos #Zone       NAME      STDOFF   RULES FORMAT [UNTIL]
    341  1.1  christos Zone  America/Chicago -5:50:36 -       LMT  1883 Nov 18 12:09:24
    342  1.1  christos                       -6:00    US      C%sT 1920
    343  1.1  christos                       -6:00    Chicago C%sT 1936 Mar  1  2:00
    344  1.1  christos                       -5:00    -       EST  1936 Nov 15  2:00
    345  1.1  christos                       -6:00    Chicago C%sT 1942
    346  1.1  christos                       -6:00    US      C%sT 1946
    347  1.1  christos                       -6:00    Chicago C%sT 1967
    348  1.1  christos                       -6:00    US      C%sT
    349  1.1  christos </pre>
    350  1.1  christos   </td></tr></table></td>
    351  1.1  christos </tr>
    352  1.1  christos <tr>
    353  1.1  christos   <th colspan="5">Columns Renamed</th>
    354  1.1  christos </tr>
    355  1.1  christos <tr>
    356  1.1  christos   <th rowspan="2">Standard Offset<br>
    357  1.1  christos     from <a href="https://en.wikipedia.org/wiki/Prime_Meridian">Prime
    358  1.1  christos     Meridian</a></th>
    359  1.1  christos   <th rowspan="2">Daylight<br>Saving Time</th>
    360  1.1  christos   <th rowspan="2">Abbreviation(s)</th>
    361  1.1  christos   <th colspan="2">Ending at Local Time</th>
    362  1.1  christos </tr>
    363  1.1  christos <tr>
    364  1.1  christos   <th>Date</th>
    365  1.1  christos   <th>Time</th>
    366  1.1  christos </tr>
    367  1.8  christos <tr>
    368  1.1  christos   <td>&minus;5:50:36</td>
    369  1.1  christos   <td>not observed</td>
    370  1.1  christos   <td>LMT</td>
    371  1.1  christos   <td>1883-11-18</td>
    372  1.1  christos   <td>12:09:24</td>
    373  1.1  christos </tr>
    374  1.8  christos <tr>
    375  1.1  christos   <td rowspan="2">&minus;6:00:00</td>
    376  1.1  christos   <td>US rules</td>
    377  1.1  christos   <td rowspan="2">CST or CDT</td>
    378  1.1  christos   <td>1920-01-01</td>
    379  1.1  christos   <td>00:00:00</td>
    380  1.1  christos </tr>
    381  1.8  christos <tr>
    382  1.1  christos   <td>Chicago rules</td>
    383  1.1  christos   <td>1936-03-01</td>
    384  1.1  christos   <td rowspan="2">02:00:00</td>
    385  1.1  christos </tr>
    386  1.8  christos <tr>
    387  1.1  christos   <td>&minus;5:00:00</td>
    388  1.1  christos   <td>not observed</td>
    389  1.1  christos   <td>EST</td>
    390  1.1  christos   <td>1936-11-15</td>
    391  1.1  christos </tr>
    392  1.8  christos <tr>
    393  1.1  christos   <td rowspan="4">&minus;6:00:00</td>
    394  1.1  christos   <td>Chicago rules</td>
    395  1.1  christos   <td>CST or CDT</td>
    396  1.1  christos   <td>1942-01-01</td>
    397  1.1  christos   <td rowspan="3">00:00:00</td>
    398  1.1  christos </tr>
    399  1.8  christos <tr>
    400  1.1  christos   <td>US rules</td>
    401  1.1  christos   <td>CST, CWT or CPT</td>
    402  1.1  christos   <td>1946-01-01</td>
    403  1.1  christos </tr>
    404  1.8  christos <tr>
    405  1.1  christos   <td>Chicago rules</td>
    406  1.1  christos   <td rowspan="2">CST or CDT</td>
    407  1.1  christos   <td>1967-01-01</td>
    408  1.1  christos </tr>
    409  1.8  christos <tr>
    410  1.1  christos   <td>US rules</td>
    411  1.1  christos   <td colspan="2">&mdash;</td>
    412  1.1  christos </tr>
    413  1.1  christos </table>
    414  1.1  christos 
    415  1.1  christos <p>There are a couple of interesting differences between Zones and Rules.</p>
    416  1.1  christos 
    417  1.1  christos <p>First, and somewhat trivially, whereas Rules are considered to
    418  1.1  christos contain one or more records, a Zone is considered to be a single
    419  1.1  christos record with zero or more <i>continuation lines</i>. Thus, the keyword,
    420  1.1  christos &ldquo;<code>Zone</code>,&rdquo; and the zone name are not
    421  1.1  christos repeated. The last line is the one without anything in
    422  1.1  christos the <code>[UNTIL]</code> column.</p>
    423  1.1  christos 
    424  1.1  christos <p>Second, and more fundamentally, each line of a Zone represents a
    425  1.1  christos steady state, not a transition between states. The state exists from
    426  1.1  christos the date and time in the previous line&rsquo;s <code>[UNTIL]</code>
    427  1.1  christos column up to the date and time in the current
    428  1.1  christos line&rsquo;s <code>[UNTIL]</code> column. In other words, the date and
    429  1.1  christos time in the <code>[UNTIL]</code> column is the instant that separates
    430  1.1  christos this state from the next. Where that would be ambiguous because
    431  1.1  christos we&rsquo;re setting our clocks back, the <code>[UNTIL]</code> column
    432  1.1  christos specifies the first occurrence of the instant. The state specified by
    433  1.1  christos the last line, the one without anything in the <code>[UNTIL]</code>
    434  1.1  christos column, continues to the present.</p>
    435  1.1  christos 
    436  1.1  christos <p>The first line typically specifies the mean solar time observed
    437  1.1  christos before the introduction of standard time. Since there&rsquo;s no line before
    438  1.1  christos that, it has no beginning. <code>8-) </code> For some places near the <a
    439  1.1  christos href="https://en.wikipedia.org/wiki/International_Date_Line">International
    440  1.1  christos Date Line</a>, the first <i>two</i> lines will show solar times
    441  1.1  christos differing by 24 hours; this corresponds to a movement of the Date
    442  1.1  christos Line.  For example:</p>
    443  1.1  christos 
    444  1.1  christos <pre>
    445  1.7  christos #Zone NAME          STDOFF   RULES FORMAT [UNTIL]
    446  1.1  christos Zone America/Juneau 15:02:19 -     LMT    1867 Oct 18
    447  1.1  christos                     -8:57:41 -     LMT    ...
    448  1.1  christos </pre>
    449  1.1  christos 
    450  1.1  christos <p>When Alaska was purchased from Russia in 1867, the Date Line moved
    451  1.1  christos from the Alaska/Canada border to the Bering Strait; and the time in
    452  1.1  christos Alaska was then 24 hours earlier than it had
    453  1.1  christos been. <code>&lt;aside&gt;</code>(6 October in the Julian calendar,
    454  1.1  christos which Russia was still using then for religious reasons, was followed
    455  1.1  christos by <i>a second instance of the same day with a different name</i>, 18
    456  1.1  christos October in the Gregorian calendar. Isn&rsquo;t civil time
    457  1.1  christos wonderful? <code>8-)</code>)<code>&lt;/aside&gt;</code></p>
    458  1.1  christos 
    459  1.1  christos <p>The abbreviation, &ldquo;LMT&rdquo; stands for &ldquo;local mean
    460  1.1  christos time&rdquo;, which is an invention of
    461  1.1  christos the <a href="https://en.wikipedia.org/wiki/Tz_database">tz
    462  1.1  christos database</a> and was probably never actually used during the
    463  1.1  christos period. Furthermore, the value is almost certainly wrong except in the
    464  1.1  christos archetypal place after which the zone is named. (The tz database
    465  1.1  christos usually doesn&rsquo;t provide a separate Zone record for places where
    466  1.1  christos nothing significant happened after 1970.)</p>
    467  1.1  christos 
    468  1.1  christos <p>The <code>RULES</code> column tells us whether daylight saving time is being observed:
    469  1.1  christos <ul>
    470  1.1  christos <li>A hyphen, a kind of null value, means that we have not set our
    471  1.1  christos clocks ahead of standard time.</li>
    472  1.1  christos 
    473  1.1  christos <li>An amount of time (usually but not necessarily &ldquo;1:00&rdquo;
    474  1.1  christos meaning one hour) means that we have set our clocks ahead by that
    475  1.1  christos amount.</li>
    476  1.1  christos 
    477  1.1  christos <li>Some alphabetic string means that we <i>might have</i> set our
    478  1.1  christos clocks ahead; and we need to check the rule the name of which is the
    479  1.1  christos given alphabetic string.</li>
    480  1.1  christos </ul>
    481  1.1  christos 
    482  1.1  christos <p>An example of a specific amount of time is:</p>
    483  1.1  christos <pre>
    484  1.7  christos #Zone NAME            STDOFF RULES FORMAT [UNTIL]
    485  1.6  christos Zone Pacific/Honolulu ...                 1933 Apr 30  2:00
    486  1.6  christos                       -10:30 1:00  HDT    1933 May 21 12:00
    487  1.1  christos                       ...
    488  1.1  christos </pre>
    489  1.1  christos 
    490  1.1  christos <p>Hawaii tried daylight saving time for three weeks in 1933 and
    491  1.1  christos decided they didn&rsquo;t like it. <code>8-) </code>Note that
    492  1.7  christos the <code>STDOFF</code> column always contains the standard time
    493  1.7  christos offset, so the local (wall clock) time during this period was GMT &minus;
    494  1.1  christos 10:30 + 1:00 = GMT &minus; 9:30.</p>
    495  1.1  christos 
    496  1.1  christos <p>The <code>FORMAT</code> column specifies the usual abbreviation of
    497  1.9  christos the time zone name. It should have one of four forms:</p>
    498  1.1  christos <ul>
    499  1.1  christos 
    500  1.9  christos <li>a time zone abbreviation that is a string of three or more
    501  1.9  christos characters that are either ASCII alphanumerics,
    502  1.9  christos &ldquo;<code>+</code>&rdquo;, or &ldquo;<code>-</code>&rdquo;</li>
    503  1.9  christos 
    504  1.9  christos <li>the string &ldquo;%z&rdquo;, in which case the
    505  1.9  christos &ldquo;<code>%z</code>&rdquo; will be replaced by a numeric time zone
    506  1.9  christos abbreviation</li>
    507  1.1  christos 
    508  1.9  christos <li>a pair of time zone abbreviations separated by a slash
    509  1.1  christos (&lsquo;<code>/</code>&rsquo;), in which case the first string is the
    510  1.1  christos abbreviation for the standard time name and the second string is the
    511  1.1  christos abbreviation for the daylight saving time name</li>
    512  1.1  christos 
    513  1.9  christos <li>a string containing &ldquo;<code>%s</code>&rdquo;, in which case
    514  1.1  christos the &ldquo;<code>%s</code>&rdquo; will be replaced by the text in the
    515  1.9  christos appropriate Rule&rsquo;s <code>LETTER</code> column, and the resulting
    516  1.9  christos string should be a time zone abbreviation</li>
    517  1.1  christos </ul>
    518  1.1  christos 
    519  1.1  christos <p>The last two make sense only if there&rsquo;s a named rule in effect.</p>
    520  1.1  christos 
    521  1.1  christos <p>An example of a slash is:</p>
    522  1.1  christos <pre>
    523  1.7  christos #Zone NAME          STDOFF RULES FORMAT  [UNTIL]
    524  1.1  christos Zone  Europe/London ...                  1996
    525  1.1  christos                     0:00   EU    GMT/BST
    526  1.1  christos </pre>
    527  1.1  christos 
    528  1.1  christos <p>The current time in the UK is called either Greenwich mean time or
    529  1.1  christos British summer time.</p>
    530  1.1  christos 
    531  1.1  christos <p>One wrinkle, not fully explained in <code>zic.8.txt</code>, is what
    532  1.1  christos happens when switching to a named rule. To what values should
    533  1.1  christos the <code>SAVE</code> and <code>LETTER</code> data be initialized?</p>
    534  1.1  christos 
    535  1.1  christos <ul>
    536  1.1  christos <li>If at least one transition has happened, use
    537  1.1  christos the <code>SAVE</code> and <code>LETTER</code> data from the most
    538  1.1  christos recent.</li>
    539  1.1  christos 
    540  1.1  christos <li>If switching to a named rule before any transition has happened,
    541  1.1  christos assume standard time (<code>SAVE</code> zero), and use
    542  1.1  christos the <code>LETTER</code> data from the earliest transition with
    543  1.1  christos a <code>SAVE</code> of zero.
    544  1.1  christos 
    545  1.1  christos </ul>
    546  1.1  christos 
    547  1.1  christos <p>And three last things about the <code>FORMAT</code> column:</p>
    548  1.1  christos <ul>
    549  1.1  christos 
    550  1.1  christos <li>The <a href="https://en.wikipedia.org/wiki/Tz_database">tz
    551  1.5  christos database</a> gives abbreviations for time zones in <i>popular
    552  1.1  christos usage</i>, which is not necessarily &ldquo;correct&rdquo; by law. For
    553  1.1  christos example, the last line in
    554  1.1  christos <code>Zone</code> <code>Pacific/Honolulu</code> (shown below) gives
    555  1.1  christos &ldquo;HST&rdquo; for &ldquo;Hawaii standard time&rdquo; even though the
    556  1.3  christos <a href="https://www.law.cornell.edu/uscode/text/15/263">legal</a>
    557  1.1  christos name for that time zone is &ldquo;Hawaii-Aleutian standard time.&rdquo;
    558  1.1  christos This author has read that there are also some places in Australia where
    559  1.1  christos popular time zone names differ from the legal ones.
    560  1.1  christos 
    561  1.1  christos <li>No attempt is made to <a
    562  1.1  christos href="https://en.wikipedia.org/wiki/Internationalization_and_localization">localize</a>
    563  1.1  christos the abbreviations. They are intended to be the values returned through the
    564  1.1  christos <code>"%Z"</code> format specifier to
    565  1.1  christos <a href="https://en.wikipedia.org/wiki/C_(programming_language)">C</a>&rsquo;s
    566  1.7  christos <a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html"><code>strftime</code></a>
    567  1.1  christos function in the
    568  1.7  christos <a href="https://kirste.userpage.fu-berlin.de/chemnet/use/info/libc/libc_19.html#SEC324">&ldquo;C&rdquo; locale</a>.
    569  1.1  christos 
    570  1.1  christos <li>If there is no generally-accepted abbreviation for a time zone,
    571  1.1  christos a numeric offset is used instead, e.g., <code>+07</code> for 7 hours
    572  1.1  christos ahead of Greenwich. By convention, <code>-00</code> is used in a
    573  1.1  christos zone while uninhabited, where the offset is zero but in some sense
    574  1.1  christos the true offset is undefined.
    575  1.1  christos </ul>
    576  1.1  christos 
    577  1.1  christos <p>As a final example, here&rsquo;s the complete history for Hawaii:</p>
    578  1.1  christos 
    579  1.8  christos <table>
    580  1.1  christos <tr>
    581  1.1  christos   <th colspan="6">Relevant Excerpts from the US Rules</th>
    582  1.1  christos </tr>
    583  1.1  christos <tr>
    584  1.8  christos   <td colspan="6">
    585  1.8  christos     <table class="rule">
    586  1.8  christos       <tr><td style="border:none;text-align:left">
    587  1.8  christos <pre class="td">
    588  1.8  christos #Rule NAME FROM TO   -    IN  ON      AT     SAVE LETTER/S
    589  1.1  christos Rule  US   1918 1919 -    Oct lastSun  2:00  0    S
    590  1.1  christos Rule  US   1942 only -    Feb  9       2:00  1:00 W # War
    591  1.1  christos Rule  US   1945 only -    Aug 14      23:00u 1:00 P # Peace
    592  1.6  christos Rule  US   1945 only -    Sep lastSun  2:00  0    S
    593  1.1  christos </pre>
    594  1.1  christos   </td></tr></table></td>
    595  1.1  christos </tr>
    596  1.1  christos <tr>
    597  1.1  christos   <th colspan="6">The Zone Record</th>
    598  1.1  christos </tr>
    599  1.1  christos <tr>
    600  1.8  christos   <td colspan="6">
    601  1.8  christos     <table class="rule">
    602  1.8  christos       <tr><td style="border:none;text-align:left">
    603  1.8  christos <pre class="td">
    604  1.7  christos #Zone NAME            STDOFF    RULES FORMAT [UNTIL]
    605  1.6  christos Zone Pacific/Honolulu -10:31:26 -     LMT    1896 Jan 13 12:00
    606  1.1  christos                       -10:30    -     HST    1933 Apr 30  2:00
    607  1.1  christos                       -10:30    1:00  HDT    1933 May 21  2:00
    608  1.1  christos                       -10:30    US    H%sT   1947 Jun  8  2:00
    609  1.1  christos                       -10:00    -     HST
    610  1.1  christos </pre>
    611  1.1  christos   </td></tr></table></td>
    612  1.1  christos </tr>
    613  1.1  christos <tr>
    614  1.1  christos   <th colspan="6">What We Infer</th>
    615  1.1  christos </tr>
    616  1.1  christos <tr>
    617  1.1  christos   <th rowspan="2">Wall-Clock<br>Offset from<br>Prime Meridian</th>
    618  1.1  christos   <th rowspan="2">Adjust<br>Clocks</th>
    619  1.1  christos   <th colspan="2">Time Zone</th>
    620  1.1  christos   <th colspan="2">Ending at Local Time</th>
    621  1.1  christos </tr>
    622  1.1  christos <tr>
    623  1.1  christos   <th>Abbrv.</th>
    624  1.1  christos   <th>Name</th>
    625  1.1  christos   <th>Date</th>
    626  1.1  christos   <th>Time</th>
    627  1.1  christos </tr>
    628  1.8  christos <tr>
    629  1.1  christos   <td>&minus;10:31:26</td>
    630  1.1  christos   <td>&mdash;</td>
    631  1.1  christos   <td>LMT</td>
    632  1.1  christos   <td>local mean time</td>
    633  1.6  christos   <td>1896-01-13</td>
    634  1.1  christos   <td>12:00</td>
    635  1.1  christos </tr>
    636  1.8  christos <tr>
    637  1.1  christos   <td>&minus;10:30</td>
    638  1.1  christos   <td>+0:01:26</td>
    639  1.1  christos   <td>HST</td>
    640  1.1  christos   <td>Hawaii standard time</td>
    641  1.1  christos   <td>1933-04-30</td>
    642  1.6  christos   <td>02:00</td>
    643  1.1  christos </tr>
    644  1.8  christos <tr>
    645  1.1  christos   <td>&minus;9:30</td>
    646  1.1  christos   <td>+1:00</td>
    647  1.1  christos   <td>HDT</td>
    648  1.1  christos   <td>Hawaii daylight time</td>
    649  1.1  christos   <td>1933-05-21</td>
    650  1.6  christos   <td>12:00</td>
    651  1.1  christos </tr>
    652  1.8  christos <tr>
    653  1.1  christos   <td>&minus;10:30&sup1;</td>
    654  1.1  christos   <td>&minus;1:00&sup1;</td>
    655  1.1  christos   <td>HST&sup1;</td>
    656  1.1  christos   <td>Hawaii standard time</td>
    657  1.1  christos   <td>1942-02-09</td>
    658  1.6  christos   <td>02:00</td>
    659  1.1  christos </tr>
    660  1.8  christos <tr>
    661  1.1  christos   <td rowspan="2">&minus;9:30</td>
    662  1.1  christos   <td>+1:00</td>
    663  1.1  christos   <td>HWT</td>
    664  1.1  christos   <td>Hawaii war time</td>
    665  1.1  christos   <td>1945-08-14</td>
    666  1.1  christos   <td>13:30&sup2;</td>
    667  1.1  christos </tr>
    668  1.8  christos <tr>
    669  1.1  christos   <td>0</td>
    670  1.1  christos   <td>HPT</td>
    671  1.1  christos   <td>Hawaii peace time</td>
    672  1.1  christos   <td>1945-09-30</td>
    673  1.1  christos   <td rowspan="2">02:00</td>
    674  1.1  christos </tr>
    675  1.8  christos <tr>
    676  1.1  christos   <td>&minus;10:30</td>
    677  1.1  christos   <td>&minus;1:00</td>
    678  1.1  christos   <td rowspan="2">HST</td>
    679  1.1  christos   <td rowspan="2">Hawaii standard time</td>
    680  1.1  christos   <td>1947-06-08</td>
    681  1.1  christos </tr>
    682  1.8  christos <tr>
    683  1.1  christos   <td>&minus;10:00&sup3;</td>
    684  1.1  christos   <td>+0:30&sup3;</td>
    685  1.1  christos   <td colspan="2">&mdash;</td>
    686  1.1  christos </tr>
    687  1.1  christos <tr>
    688  1.8  christos   <td colspan="6" class="footnote">
    689  1.1  christos     &sup1;Switching to US rules&hellip;most recent transition (in 1919) was to standard time
    690  1.1  christos   </td>
    691  1.1  christos </tr>
    692  1.1  christos <tr>
    693  1.8  christos   <td colspan="6" class="footnote">
    694  1.1  christos     &sup2;23:00 <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>
    695  1.1  christos     + (&minus;9:30) = 13:30 local
    696  1.1  christos   </td>
    697  1.1  christos </tr>
    698  1.1  christos <tr>
    699  1.8  christos   <td colspan="6" class="footnote">
    700  1.1  christos     &sup3;Since <a href="https://en.wikipedia.org/wiki/ISO_8601">1947&ndash;06&ndash;08T12:30Z</a>,
    701  1.1  christos     the civil time in Hawaii has been
    702  1.1  christos     <a href="https://en.wikipedia.org/wiki/Universal_Time">UT</a>/<a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>
    703  1.1  christos     &minus; 10:00 year-round.
    704  1.1  christos   </td>
    705  1.1  christos </tr>
    706  1.1  christos </table>
    707  1.1  christos 
    708  1.1  christos <p>There will be a short quiz later. <code>8-)</code></p>
    709  1.1  christos 
    710  1.1  christos <hr>
    711  1.1  christos <address>
    712  1.1  christos This web page is in the public domain, so clarified as of
    713  1.1  christos 2015-10-20 by Bill Seymour.
    714  1.1  christos <br>
    715  1.1  christos All suggestions and corrections will be welcome; all flames will be amusing.
    716  1.1  christos Mail to was at pobox dot com.
    717  1.1  christos </address>
    718  1.1  christos </body>
    719  1.1  christos </html>
    720