Thanks for the testing help + conclusions.
Last friday I asked you all for help with testing a thing. I got over 60 answers, thanks a lot for that! I have been able to draw a good set of conclusions. What was it all about? Well, the test was to see if it is possible to figure out what time zone you are in with reasonable reliability and reasonable effort. And the answer is: No.
You it can’t be done with reasonable reliability, because I had some cases, even at the end, of not being able to find the time zone on a default installed Ubuntu. This problem seems to go away if you go in and reconfigure the time zone. But if every twentieth person that has installed a new server gets this problem (and that seems a reasonable minimum after the tests, we had several cases just on Ubuntu where there is definitely not more that 20 Ubuntus. In fact, I have some five confirmed Ubuntus in the test and two of them failed on all the techniques mentioned in this blog post. Yup, I have some 100 lines of code trying to figure out the time zone on unices, and it failed on two out of five to fifteen Ubuntus. That is not reliable in my book.
Also, it won’t work on Windows 9x. And non-english versions of XP hasn’t gotten much testing, and no-one seems to have tested it on Vista, so the reliability on Windows is unknown.
And this is with an unreasonable amount of effort. On unix I first try to figure out the timezone from TZ or /etc/localtime, which is the actual config. Then I look at three different config files. If that fails I actually compare /etc/localtime to all existing time zone files to see if they are the same. This is a silly amont of work to figure out a time zone. Especially considering that it still doesn’t work reliably.
Windows is somewhat less work, but still way to much.
So, what is the conclusion, and the result? The conclusion is that you can not reliably figure out the time zone name on your computer. And that in turn affects how to fix a particular bug in Zope. Instead of trying to figure out the name of the local timezone, we need to wrap the local configuration information (available in /etc/localtime under unix, and in the windows registry under windows). We’ll have to wrap this “anonymously”, i.e. we won’t know what the local time zone is called, but we rarely need to know that. We just need to know the information. It means that under Windows, daylight saving calculations for past dates will in some cases be incorrect (because Windows doesn’t keep a DST history like zoneinfo does) but that’s a minor problem.
More on what that means in another post.