tz-how-to.html 24 KB

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