|
Posted by Sig on 06/24/07 17:10
On Sat, 23 Jun 2007 10:44:14 -0400 David T. Ashley said
> "Sig" <ivanlid@example.com> wrote in message
> news:MPG.20e65d5b8466b279989681@islay...
> > On Sat, 23 Jun 2007 01:04:46 -0400 David T. Ashley said
> >> Is it true on my system that the Unix time may skip up or down by one
> >> second
> >> at midnight when there is a leap second?
> >>
> >> By "Unix time" I mean the integer returned by time() and similar
> >> functions.
> >>
> >> I'm concerned about the "down" case. Some of the software I've written
> >> assumes monotonically-increasing time.
> >
> > I don't think you have to worry.
> >
> > (1) NIST says "Based on what we know about the earth's rotation, it seems
> > unlikely that we will ever have a negative leap second."
> > <http://tf.nist.gov/general/leaps.htm#Anchor-52904>
> >
> > (2) If it did happen, the time would repeat, not go backwards.
> >
>
> If I'm understanding your comment correctly, and if I'm not mixed up myself,
> I believe you have the sign wrong in the way you're thinking about leap
> seconds. An ordinary (positive) leap second is where you insert an extra
> second and "time stands still" for a second (this is akin to February 29).
> I believe these will get more frequent as the earth's rotation is slowing
> down.
>
> An ordinary leap second ("time stands still") actually in effect gives the
> earth's rotation time to "catch up" to the kept time.
>
> A negative leap second would result in the Unix time skipping a second
> (jumping forward).
>
> Of course, "time standing still" can't happen on a computer system, so you
> have to re-use a Unix time value (i.e. Unix time goes backwards).
>
> So, I believe but am not sure that due to a sign mixup, the case that you
> have presented as impossible is actually the normal and expected case.
>
> According to the entry on Wikipedia,
>
> http://en.wikipedia.org/wiki/Unix_time
>
> Unix time will re-use certain integers when a leap second occurs. That
> surprised me, but it may very well be true.
>
> My application is generating unique identifiers in PHP (as part of web
> database scripts). The current scheme I use is:
You're right, I was over hasty (and backwards) in my interpretation of NIST's
positive and negative.
However, ignoring the issue of local clock correction, brought up elsewhere in
this thread, my comment on monotonicity stands. The seconds count will repeat,
rather than go backwards.
--
http://koiclubsandiego.org/comment/?r=8
Navigation:
[Reply to this message]
|