To help those of use with daylight savings time...

Posted by Shaun Biggs on Thu 17 Jan 2008 10:44 PM — 5 posts, 24,974 views.

USA #0
I just noticed that all of the times listed for the posting are an hour off, since I forgot to reset my time a few months ago. Is there chance of us getting the option to obey the insanity called "Daylight Savings Time" at all? It is a system I think we should have abolished, but since it is mandated by my government, could there be a way to set the time to the U.S Eastern Time Zone instead of just -5 or -4 UTC changing manually every few months?
Australia Forum Administrator #1
Well I think that DST changes from year to year, and from place to place.

For example, here in Australia they legislated during the 2004 Olympics to put it back (or is it forwards?) a week so that the Olympic Games had more daylight, but only for that year.

Also some states in Australia (Queensland I think) don't use Daylight Saving, whereas others, on the same longitude, do.

So, to automatically adjust would be quite complex.
#2
Quote:
So, to automatically adjust would be quite complex.

Yes, which is why you use other people's code to do it for you.

At least, in Python there is a user-contributed library called pytz which takes a 'timezone' of the form "Australia/Adelaide" or "US/Eastern" and produces an object that can be passed back to the main date/time routines to convert to and from UTC or unix epoch. It uses the information in Olson timezone database with a matching version number.

(A little searching shows php5.1+ is supposed to have the same ability in the standard library?)
USA #3
Linux distributions come with code to do this too; I believe it's part of the standard gcc libraries.
USA #4
I have no idea if it is part of gcc libraries or not, but I know on my Linux box, I can set the timezone to any of a number of different settings, similar to what Isthiriel mentioned with pytz. They even automagically updated everything last year when they went and moved the dates around a month or so. Now the gap for the U.S. is Nov/March instead of Oct/April. In theory, this will save us on energy costs in some odd fashion... right...

UTC or bust!