<div dir="ltr"><div>Heads up for Stephen Colebourne: this post highlights a discrepancy between Joda Time and tzdump, so you may want to read carefully :)</div><div><br></div>This is in relation to my earlier message about the text format. My confusion here is the reason I'm anxious to see canonical data :)<div><br></div><div>Currently, both Joda Time and Noda Time have some interesting code when working out the transitions for a time zone which checks whether the later transition occurs at the same <i>local</i> time as the earlier transition, and if so extends the earlier transition to consume the later one.</div><div><br></div><div>I've worked out that this is basically to handle an oddity that sometimes occurs when standard offsets change. One example of a zone in which this happens is America/Juneau. Here are the zone lines from 2015e, and I've highlighted the ones we're immediately concerned with:</div><div><br></div><div><div>Zone America/Juneau<span class="" style="white-space:pre">     </span> 15:02:19 -<span class="" style="white-space:pre">       </span>LMT<span class="" style="white-space:pre">       </span>1867 Oct 18</div><div><span class="" style="white-space:pre">                        </span> -8:57:41 -<span class="" style="white-space:pre">       </span>LMT<span class="" style="white-space:pre">       </span>1900 Aug 20 12:00</div><div><span class="" style="white-space:pre">                  </span> -8:00<span class="" style="white-space:pre">    </span>-<span class="" style="white-space:pre"> </span>PST<span class="" style="white-space:pre">       </span>1942</div><div><span class="" style="white-space:pre">                       </span> -8:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>P%sT<span class="" style="white-space:pre">      </span>1946</div><div><span class="" style="white-space:pre">                       </span> -8:00<span class="" style="white-space:pre">    </span>-<span class="" style="white-space:pre"> </span>PST<span class="" style="white-space:pre">       </span>1969</div><div><span class="" style="white-space:pre">                       </span> -8:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>P%sT<span class="" style="white-space:pre">      </span>1980 Apr 27  2:00</div><div><span class="" style="white-space:pre">                 </span> -9:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>Y%sT<span class="" style="white-space:pre">      </span>1980 Oct 26  2:00</div><div><b><span class="" style="white-space:pre">                        </span> -8:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>P%sT<span class="" style="white-space:pre">      </span>1983 Oct 30  2:00</b></div><div><b><span class="" style="white-space:pre">                      </span> -9:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>Y%sT<span class="" style="white-space:pre">      </span>1983 Nov 30</b></div><div><span class="" style="white-space:pre">                      </span> -9:00<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>AK%sT</div></div><div><br></div><div>The US rules in force at the time are:</div><div><br></div><div><div>Rule<span class="" style="white-space:pre">    </span>US<span class="" style="white-space:pre">        </span>1967<span class="" style="white-space:pre">      </span>2006<span class="" style="white-space:pre">      </span>-<span class="" style="white-space:pre"> </span>Oct<span class="" style="white-space:pre">       </span>lastSun<span class="" style="white-space:pre">   </span>2:00<span class="" style="white-space:pre">      </span>0<span class="" style="white-space:pre"> </span>S</div><div>Rule<span class="" style="white-space:pre">      </span>US<span class="" style="white-space:pre">        </span>1976<span class="" style="white-space:pre">      </span>1986<span class="" style="white-space:pre">      </span>-<span class="" style="white-space:pre"> </span>Apr<span class="" style="white-space:pre">       </span>lastSun<span class="" style="white-space:pre">   </span>2:00<span class="" style="white-space:pre">      </span>1:00<span class="" style="white-space:pre">      </span>D<br></div></div><div><br></div><div>So, the first bolded zone line comes to an end at the instant of the transition into standard time, while standard time is -8 (so a wall offset of -7). I assume this transition should <i>not</i> be included in the eventual set of transitions (i.e. the bound given is exclusive). This would occur at 1983-10-30T09:00Z.</div><div><br></div><div>Now, in the second bolded zone line, the standard offset is -9 instead, so the transition into daylight saving time would occur at 1983-10-30T10:00Z.</div><div><br></div><div>So looking at the rules in a naive way, residents of Juneau would have to change their watches twice on October 30th 1983. At 2am they'd put their watches back an hour to account for the change in standard time (but still be in daylight saving time)... and then when it next hit 2am they'd put their watches back <i>another</i> hour to account for the transition into standard time. Now, I'm pretty sure that's not what's intended, and indeed zdump shows just a single transition setting local time back two hours at 1983-10-30T09:00Z:</div><div><br></div><div><div>America/Juneau  Sun Oct 30 08:59:59 1983 UTC = Sun Oct 30 01:59:59 1983 PDT isdst=1<br></div><div>America/Juneau  Sun Oct 30 09:00:00 1983 UTC = Sun Oct 30 00:00:00 1983 YST isdst=0</div><div><br></div></div><div>... whereas Noda Time (and, I've just checked, Joda Time) have a single transition at 1983-10-30T10:00Z instead.</div><div><br></div><div>Is it documented somewhere what should happen in this case? (As a side question, is there a single canonical place documenting the time zone data format? I've found various sources over the years, but it would be nice to have somewhere canonical - ideally either within each release or on the IANA home page. The Theory file gives a lot of interesting more abstract<i> </i>information, but a single place saying "Here is what each file in the release means, with details of its format" would be very welcome. Apologies if it already exists and I've just missed it...)</div><div><br></div><div>Jon</div><div><br></div><div><br></div></div>