Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Leap Second

by esskar (Deacon)
on Dec 31, 2005 at 01:47 UTC ( [id://520095]=perlmeditation: print w/replies, xml ) Need Help??

The next leap second will hit us tonite. The question is: can Date::Calc handle it ? :-)

Replies are listed 'Best First'.
Re: Leap Second
by swampyankee (Parson) on Dec 31, 2005 at 02:59 UTC

    The leap seconds are not assigned on a regular basis. While leap years arrive predictably, leap seconds don't. The only way for a computer to know about leap seconds is to be connected to something similar to an RFC-867 time server NIST Internet Time Service. Can Date::Calc manage that? I've no clue, although there would seem to be no reason why a clever Perl programmer (i.e., not me) couldn't write Date::Calc:RFC-867 module to check for leap seconds.

    emc

    " When in doubt, use brute force." — Ken Thompson
      The leap seconds are not assigned on a regular basis. While leap years arrive predictably, leap seconds don't. The only way for a computer to know about leap seconds is to be connected to something similar to an RFC-867 time server NIST Internet Time Service.
      Well, that's not the only way. While leap seconds aren't assigned on a regular basis, they are announced way in advance, and leap seconds in the past aren't erased. A module dealing with leap seconds could just use a plain text file to store the leap seconds. A cron job to check the validity of the file run four times a year will be enough.
      Perl --((8:>*
        and leap seconds in the past aren't erased.

        Leap seconds can need to be subtracted, (due to nutation?), though this is likely to occur much less frequently than their being added. It also doesn't detract from your quoted point, but does complicate things a little.

        I also read(search for IERS) that leap seconds are only added on June 31st30th or December 31st, so bi-annual updates should suffice.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        A module dealing with leap seconds could just use a plain text file to store the leap seconds. A cron job to check the validity of the file run four times a year will be enough.

        But where's the fun in that? More fun (this is why my kids think I'm nuts) would be to write a module to just read the RFC-867 data from the NIST Internet Time Service and do it automatically.

        I just think it would take a Perlist who is either better than I am or has more free time. Preferably both. Any volunteers?

        emc

        " When in doubt, use brute force." — Ken Thompson
Re: Leap Second
by Perl Mouse (Chaplain) on Dec 31, 2005 at 02:01 UTC
    It doesn't have to. Under Unix time keeping, leap seconds don't exist. Computer clocks will have to be adjusted.
    Perl --((8:>*
      It doesn't have to. Under Unix time keeping, leap seconds don't exist. Computer clocks will have to be adjusted.

      While the the whole POSIX time / leap seconds issue is a rather complicated mess (for those interested in gory details see The Future of Leap Seconds, History of IEEE P1003.1 POSIX time and Unix time) I'm not sure how it's relevant to how Date::Calc handles leap seconds?

      Indeed, as documented, Date::Calc says that Time_to_Date() and Date_to_Time() take/return UTC time values that include leap seconds. The documentation appears to be lying though :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://520095]
Approved by pboin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-28 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found