Skip to content

Thanks for the testing help + conclusions.

May 13, 2008

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.

About these ads
  1. Definitely file a bug with Ubuntu, they are pretty good at fixing stuff like this quickly.

    In any case, getting the Zope bug fixed and being able to say “well, make sure you have saved your timezone settings at least once if you’re on Ubuntu” or “if you’re on Windows, DST will sometimes be off” is a much better answer than the one we currently have, which is “it doesn’t work”. ;)

    Thanks for looking into this! I’ve been frustrated with time zones since I started using Zope back in year 2000. :)

  2. Well, the backup plan it to make everybody set a TZ environment to Somewhere/Someplace. I think that already works, at least in trunk.

    I might file a bug with Ubuntu, the problem being that it isn’t really a bug, and btw, it only fixes the problem on Ubuntu. It’s still stupidly complicated.

  3. I think you or somebody else should file bug reports with Ubuntu and Red Hat. This way it gets fixed once and for all. Or maybe somebody reading this is patch savy enough when it comes to Linux and can do it?

  4. I promise I could not see your comments when I posted the above comment :-)

  5. “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)”

    Beginning with Windows Vista, Windows does keep historical daylight savings data.

    Have you seen the win32timezone module (part of the pywin32 project), which abstracts away a lot of the pain of dealing with the registry?

  6. I took at look at a Windows 7 machine, and I couldn’t find any data before 2005, so either I didn’t find it, or it’s a pretty narrow view of “Historical”. :-)

Trackbacks & Pingbacks

  1. Please run a test for me (it takes only minutes) « Lennart Regebro: Plone consulting

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 1,225 other followers

%d bloggers like this: