ikegami has asked for the wisdom of the Perl Monks concerning the following question:

A bill has been signed, extending daylight saving time in the US. The change is to take effect in 2007.

Hopefully, upgrading the time zone table in our operating systems will fix everything. Is there anything else we should do to ensure our scripts keep working? to ensure Perl keeps working? to ensure PerlMonks keeps working?

Update: Corrected title.

  • Comment on Changes in USA's Daylight Saving Time (DST)

Replies are listed 'Best First'.
Re: Changes in USA's Daylight Savings Time (DST)
by Zaxo (Archbishop) on Aug 08, 2005 at 19:51 UTC

    We should start preparing panicky press releases. This could be another Y2K boom if we play it right.

    After Compline,
    Zaxo

Re: Changes in USA's Daylight Savings Time (DST)
by jfroebe (Parson) on Aug 08, 2005 at 20:12 UTC

    Hi,

    As the Daylight Savings Time varies quite radically within the United States (let alone elsewhere), a lookup table for applications is probably a good idea anyways regardless of the new law. A related note: I prefer to have the database systems running on UTC time and let the client application handle the conversion to the appropriate time zone.

    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

Re: Changes in USA's Daylight Savings Time (DST)
by japhy (Canon) on Aug 08, 2005 at 20:40 UTC
    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
      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

Re: Changes in USA's Daylight Savings Time (DST)
by jk2addict (Chaplain) on Aug 08, 2005 at 19:53 UTC

    The one thing I keep thinking about is calculations of elapsed time between two dates, esp if the older date is pre 1987 DST changes and the second date is post 2007 changes and one of those are not in GMT.

Re: Changes in USA's Daylight Savings Time (DST)
by halley (Prior) on Aug 09, 2005 at 01:48 UTC
    To further my reputation for inserting tangential trivia instead of just answering a question, let me mention that it is Daylight Saving Time, not Savings. It's not a bank like "First Federal Savings and Loan."

    --
    [ e d @ h a l l e y . c c ]

      Hi,

      Thanks :) I grew up knowing it with the extra s. You are correct and to our credit, many text books list it one way or the other. (in some cases, it will be listed with the extra s in one section and without in another.

      Thanks for letting us know the correct spelling. I definitely ++ your post :)

      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

      To further my reputation for inserting tangential trivia instead of just answering a question, let me mention that it is Daylight Saving Time, not Savings.

      Well if you're going to be picky, surely a compound preposed adjective should have a hyphen in it:

      • "daylight-saving time" parses as "time with daylight saving", which is presumably what is intended.
      • "daylight saving time" parses as "saving time with daylight". I've no idea what "saving time" is (as a noun), but perhaps it's something to do with that bank you mentioned ...

      To put it in Perl terms: adjectives are right-associative.

      Smylers

        Or to be even more picky, the use of a hyphen is only appropriate when a non-adjective forms part of a compound adjective. The normal but less readable way of denoting two or more adjectives is to use a comma between adjectives. This example, using non-adjectives in the mix, shows where a hyphen is required, where a comma is required and where neither is required (where an adverb describes the adjective):

        Really picky, showing-the-commas, daylight-saving time.

        -S

        One world, one people

        To be absolutely picky: any proper noun is only properly spelled and pronounced when it is spelled and pronounced the way that the owner wants it spelled and pronounced. Thus, grammar has nothing to do with it.

        To put it in Perl terms: Global symbol "Daylight Savings Time" requires explicit package name. Execution aborted due to compilation errors.

        --
        [ e d @ h a l l e y . c c ]

Re: Changes in USA's Daylight Savings Time (DST)
by anonymized user 468275 (Curate) on Aug 08, 2005 at 21:21 UTC
    Of course, in the unlikely event that a system for some reason makes itself responsible for daylight saving time calculations, e.g. by having a local database of DSTs, then it would need updating. I am not at my own machine to download and check perl's Time::Local, which any decent perl-based system will depend on one way or another, but its maintainers have a mailing list at datetime-subscribe@perl.org

    One world, one people