Bruce Fitzsimons (bwooce) wrote,
Bruce Fitzsimons

The TZ issue is still not resolved

Facts I have discovered

1. There is 1 (one) publicly maintained list of Timezone rules for computers in the entire world (, the "Olsen" lists.
2. These lists and associated portable C code are used by almost all Unix in the world. HP-UX being the only exception I can find.
3. The TZ rule text format is one of the most unparsable I've seen. The rules (although complex and flexible) have many implicit facets.
4. All the code seems to ignore that most people in the world only know their 3-4 character TZ code (NZDT, CET, EST, etc). The American ones are listed, of course...
5. Some people have attempted to reparse the TZ database into a more usable form:
5.1 The libical team implementing VTIMEZONE from the iCal RFC, although this project seems to have fractured and splintered a lot. The ximian evolution team who originally did this had a convertor from Olsen->VTIMEZONE format, but this is apparently now lost, and they're using static copies of old rules.
5.2 The IBM OSS library whose name I forget, now (just) has code for implementing a full set of Olsen TZ rules inside it. It "compiles" the files into almost the same form as the original, and then works over that to produce a file that (so far) has defied my attempts to work out what the hell they're doing.
6. POSIX is pretty shite. It ignores leap seconds, the the Olsen code allows you to read it.
7. The posixrules file I was going to use is simply a weirdass artifact of POSIX, and is usually just a link to the file you're using for your local timezone. Except some linux distros (Gentoo) don't get that, which is probably because its completely stupid.
8. All the POSIX unix functions are a pile of cack. The Olsen ones (sorry Mr Olsen) aren't much better.


There does not appear to be any code anywhere in the world that allows accurate, updateable, TZ conversions without shagging around the operating system (and causing the implicit actions I ranted about below).

I briefly attempted to define some C++ objects to hold the Olsen data in a useable form. The final design I came up with was basically just a consecutive list of A-B periods describing an offset from GMT/UTC for each TZ. I've stopped for the moment as parsing caused me headaches, and I've realised that doing the above is quite a lot of work for a machine to do, so maybe precompling is a better option. I do want to end up with 1 file or header that describes it all though. Maybe I'll end up doing a 3GPP copout and gzip the expanded version...

I cannot believe this situation. Does noone in the world need to do TZ conversions properly?
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded