[Tutor] Daylight saving time issue

alan.gauld@bt.com alan.gauld@bt.com
Wed, 7 Nov 2001 11:52:13 -0000


>    I am trying to determine a given date is in dst or
> not. 

This is incredibly difficult to do correctly.
I once had a summer graduate student spend 3 months 
writing up a paper on use of local time in a 
globally distributed system - and he wasn't able 
to complete it in the 3 months!

Consider a few of the more obvious and trivial 
examples of the kind of problems you meet:

> to consider the day when day light saving time occurs,
> which is in Oct and April each year. 

That depends entirely on the locality.
On a skiing trip to Andorra (a small principality 
between France and Spain) a few years ago the snow 
was melting too fast so the government held a 
special session and switched to DST a week early 
to try to preserve the snow... 
This was done by the simple expedient of announcing 
it on the "national" news and putting posters up 
in each town square.

In the UK the changeover occurs in March and October
In the US it happens on the last weekend of the 
respective month, in the UK it happens on the 4th 
weekend. These are normally the same but not always! 
(Actually it may be the other way around, I can't 
remember... but it did cause us problems when 
the PC BIOS(US made) tries to change and NT and 
Unix(using Locale settings) didn't!)

Also some places don't have DST at all. Other do but 
it's by more than 1 hour. (A few places its only 30 
minutes!)

When you start to account for the 37 or so different 
timezones around the world too local time is a nightmare!

Alan G.