[tz] [Patch] Make it slightly easier to parse tzdata

Alan Barrett apb at cequrux.com
Sun Nov 2 08:10:51 UTC 2014

On Fri, 31 Oct 2014, Ed Schouten wrote:
> While writing a Python script to translate the data, I noticed 
> that there is a very small number of directives that would 
> require quite a lot of additional code to parse properly. For 
> example, "lastSun" makes a lot of sense as a special keyword in 
> "Rule" directives, but it provides no functional gain in "Zone" 
> directives.

You can translate "lastSun" to a specific date during the 
conversion from tzdata's text format to your binary format.  Then 
you would not need to do it in the embedded code that parses your 
binary format.

> The same holds for the use of the "Dec 29 24:00" time used in 
> Samoa's timezone. We should be able to use "Dec 30" instead, 
> right?

Even if you can get it to work, I would advise against trying 
to write "Dec 30" in any rules for Samoa in 2011.  There was no 
30 December 2011 in Samoa, because at midnight at the end of 29 
December 2011, their clockes jumped ahead 24 hours to the midnight 
at the beginning of 31 December.

Ordinarily (but not in Samoa in 2011), "Dec 29 24:00" and "Dec 30 
00:00" would mean the same thing, and you could translate between 
them when you create your binary data.  However, "Dec 30" with 
an unspecified time is supposed to mean "an unknown time on 30 
December", and tzdata uses this style when the exact time of a 
transition is unknown.

--apb (Alan Barrett)

More information about the tz mailing list