Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Leap Second

by Perl Mouse (Chaplain)
on Dec 31, 2005 at 08:15 UTC ( [id://520113]=note: print w/replies, xml ) Need Help??


in reply to Re: Leap Second
in thread Leap Second

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:>*

Replies are listed 'Best First'.
Re^3: Leap Second
by BrowserUk (Patriarch) on Dec 31, 2005 at 08:57 UTC
    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.

      only added on June 31s

      31 June would be a leapday, right? Guess you were thinking about 30 June, the last day of the month.

      Cheers, Sören

        Indeed. Thanks, corrected.


        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.
      In an "emergency", IERS could add leap seconds at the end of March or September. Presumably this would happen with less than the 6 months less a few days warning that June/December leap seconds get.
      I also read(search for IERS) that leap seconds are only added on June 30th or December 31st, so bi-annual updates should suffice.
      But you don't want to update your lists at the times leap seconds are added (or skipped). We're talking about Date::Calc, and some people use it to calculate dates in the future. You want to update your lists as soon as it has been decided a leap second will be added or skipped. I don't know how often people meet to determine whether we'll need another leap second, but I doubt it's more often than four times a year.
      Perl --((8:>*
Re^3: Leap Second
by swampyankee (Parson) on Dec 31, 2005 at 17:53 UTC

    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
      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.
      How would you actually do that? RFC-867 seems to be a protocol to send the current time - how would you use that to determine when leap seconds have happened? Even if you'd now start querying the server every second to determine a possible leap second, it wouldn't really help Date::Calc - you have no information about leap seconds in the past, nor about any upcoming leap seconds.
      Perl --((8:>*

        The package definition used by NIST (apparently RFC-867 doesn't define the packet very well) includes a flag which inidicates whether a leap second will be added or subtracted at the end of the month.

         Since the leap second correction is always (with NIST) on the last day of the month, it would really only be necessary to check sometime before midnight on the last day of the month.

        emc

        " When in doubt, use brute force." — Ken Thompson
      But where's the fun in that?
      The fun is disproving that your statement The only way for a computer to know about leap seconds ... is false.

      Perl --((8:>*

        Touché

        emc

        " When in doubt, use brute force." — Ken Thompson

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found