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