Re: [MacPerl-Porters] MacPerl daylight saving time issue

[email protected] (Peter Prymmer) Sun, 15 Sep 2002 18:35:17 +0000 (GMT)
Newsgroups perl.macperl.porters
Message-ID <[email protected]>
On Fri, 13 Sep 2002, Thomas Wegner wrote:

> Hi,
>
> to make a long story short: In the past, I have sent some Mac OS
> patches to Steffen Beyer for his Date::Calc module. He just released
> Date::Calc 5.1, which is basically version 5.0 plus Mac OS Classic
> support. While running the module tests for a pre-release version, I
> noticed 3 failures, all related to the daylight saving time flag.
> $dst is 0 for winter time, and 1 for summer time (and -1 if not
> supported). Said tests check if $dst == 0 for a given date and fail.
> My Mac is currently set to summer time, hence I first thought that
> $dst is correctly set to 1. But Steffen reminded me, that on Unix,
> Windows etc. the daylight saving time flag is set according to the
> given date. For instance, on December 24th, 2001, $dst should be 0
> (see the sample script below), right? But obviously, if a Mac is set
> to summer time, and I check the Christmas Eve date, $dst will be 1
> (!). My conclusion: $dst depends on the Date&Time control panel
> setting, and not on a given date. I won't say this is a bug, but it
> is, isn't it? :-)

While I cannot comment on any possible problem in GUSI I can
tell you that the message regarding Unix and Windows behavior
from Steffen is incorrect.  24 December 2001 may have $dst == 0
for many Northern latitudes, while it may have $dst == 1 for many
Southern lattitudes (i.e. those south of the equator).

The settings of daylight savings time is a political matter
and rather difficult to capture accurately in computer
programming, since among other things laws regarding the
setting of daylight savings times depends on laws that
may be written well after an operating system or programming
language is released.  At least on Unix the rules are
easily amended by careful placement of symlinks in the
filesystem (at linux implements it that way).

For "convenient" examples of how complex the rules can be
try to determine the GMT offset of eastern and western
Indiana in the US for different dates.  Now do the same
exercise for each of the Australian states (they have
30 minute and 45 minute offsets from the hours GMT offset).

For what it is worth I think that the result you obtained
is perfectly fine for e.g. Sydney on 24 Dec 2001.

Peter Prymmer