in reply to Changes in USA's Daylight Saving Time (DST)

While this is not necessarily specific to the days on which DST starts and ends, this is relevant advice I always give on this matter: when doing date arithmetic without the use of Date:: modules, always always ALWAYS use a neutral time of day. If you need to get a Unix time for a given day, choose a time like noon:
use Time::Local; my $time = timelocal(0,0,12, (localtime)[3,4,5]);
This way, you can add and subtract days worth of seconds from $time without worrying about DST.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: Changes in USA's Daylight Savings Time (DST)
by itub (Priest) on Aug 09, 2005 at 14:45 UTC
    I'm sorry, I don't understand. What is a "neutral" time?
      A "neutral" time is an hour of the day that will not cause you skip or double a day when going over a daylight savings time boundary.

      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

      Hi,

      When dealing with a small set of time zones (Eastern through Pacific for example) one can drop the hours to determine the number of days between two datetimes.

      2:05pm would become 12 noon. 1am would become 12 noon. So the # of days between 05:02 Aug 4, 2005 and 10:08pm Aug 10, 2005 is 6 days not 6.xxx days

      The granularity is a day so a small number of calculations in this manner would provide fairly accurate # of days. With a large number of calcuations, the truncating of the hours will start to become an issue.

      It's a quick and dirty hack that is often sufficient for many things. We often will drop the hours when we count back in our heads.

      Jason L. Froebe

      Team Sybase member

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1