[tz] Precise meaning of FROM and TO in a rule

David Braverman david at braverman.org
Mon Jul 7 21:17:15 UTC 2014


I think this ambiguity is hard to create in practice. Transition rules are always expressed in the UTC offset that the time zone is leaving. So, even if you had this:

# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
Rule	Erewhon	2014	only	-	Jan	1	0:00	1:00	D

...that would indicate that the new zone offset begins at midnight January 1st local wall-clock time, regardless of what that wall clock time is. Say that Erewhon is UTC-6 on December 31st. The rule above unambiguously says to do this:

UTC			Wall clock
2013-12-31 23:59	2013-12-31 17:59
2014-01-01 00:00	2013-12-31 18:00
2014-01-01 05:59	2013-12-31 23:59
2014-01-01 06:00	2014-01-01 01:00
2014-01-01 06:01	2014-01-01 01:01

Does the C code have a different implementation?

David Braverman
Inner Drive Technology
http://www.inner-drive.com/demo/timezones.aspx



From: tz-bounces at iana.org [mailto:tz-bounces at iana.org] On Behalf Of Jon Skeet
Sent: Monday 7 July 2014 15:38
To: tz at iana.org Mailing List
Subject: [tz] Precise meaning of FROM and TO in a rule

Sorry to be pedantic again, but I'm trying to get my head round some fiddly code, and I've come across an interesting bit of ambiguity.

FROM and TO are described like this:

FROM Gives the first year in which the rule applies. Any integer
year can be supplied; the Gregorian calendar is assumed. The
word minimum (or an abbreviation) means the minimum year
representable as an integer. The word maximum (or an
abbreviation) means the maximum year representable as an
integer. Rules can describe times that are not representable
as time values, with the unrepresentable times ignored; this
allows rules to be portable among hosts with differing time
value types. 
 
TO Gives the final year in which the rule applies. In addition to
minimum and maximum (as above), the word only (or an
abbreviation) may be used to repeat the value of the FROM
field.

It's not clear whether that "year" is:
1. The year in UTC at the transition
2. The year in the local time before the transition
3. The year in the local time after the transition
4. The year in the same frame of reference as the "AT" part
Option 1 seems unlikely.

Options 2 and 3 seem likely to be equivalent in all realistic time zones - it would be odd for a time zone to add an hour of DST at 11.30pm on December 31st, for example... and even odder for it to subtract an hour of DST at 00.30am on January 1st.

Option 4 is tricky. In some ways it feels natural - if you're going to use one frame of reference for a time, why not do it for the date as well? On the other hand, it means that a "TO" value of (say) 2001 where the transition is at 2am UTC on January 1st in a time zone with a standard time of UTC+8 would actually have its last transition in 2000 local time, assuming I've got my maths right.

Can I assume that one of option 2 or option 3 is intended, and that no sensible time zone will ever make those two options behave differently?

I've tried reading the C source code, but given the subtleties involved, I'd rather trust a natural language description. If we can come to a conclusion about this, I'd like to propose that we amend the text to be unambiguous, too.

Jon



More information about the tz mailing list