POSIX time will jump discontinuously backwards after the leap second, counting:
59.50
59.75
60.00
60.25
60.50
60.75
60.00
Or, if your clock implementation is not POSIX-compliant but follows Mills' paper instead:
59.50
59.75
60.00
59.25
59.50
59.75
60.00
It gets weird, though: since this information was only made available recently, your computer may not know the leap second exists. In that case, its upstream NTP servers will jump and the local ntpd will slew the clock smoothly over the discontinuity, IIRC.
OTOH, if your system is aware of the leap second and if you're using the system clock to calculate intervals (i.e. t2 - t1), expect possibly negative or zero intervals over this timeframe. If you're calculating rates over a roughly 1-second interval, divide-by-zero bugs are definitely possible.
On a related note, does anyone know what the Oracle and OpenJDK JVMs do with respect to System.currentTimeMillis? They claim it's number of seconds since the epoch, which would imply this timer will not encounter discontinuities. The only ways I can think of to achieve that are by reading the system clock state to look for the leap insert/del/doublecount flag, or read a copy of the leap second table.
[edit] You may be asking, "Why would anyone use a system of time in which two numbers could refer to the same instant, or one in which a given number could refer to no time at all? Why not use a time system in which you could subtract two times from each other to get the interval between them? Or hell, even a time system where time always increases, you know, so we could order events.
The closest thing we have to such a time scale is TAI (http://en.wikipedia.org/wiki/International_Atomic_Time), which is what most computer systems like to pretend their clocks are: "the number of seconds since an epoch".
UTC and POSIX time are adjusted, relative to TAI, to keep the number of seconds in a given day at a nice "easy" 86400, which is why we're in this mess. Given that it takes plenty of math to translate a number like 1339696998.435347 into a human-readable date, I think our computers should just be keeping TAI to begin with and make the whole process easier on ourselves; but so many systems assume UTC or POSIX time that we're stuck with it.
I think you're glossing over the fact that POSIX time was designed to correspond to UTC without needing additional information. Since leap seconds vary in response to solar and geological phenomena, converting from TAI to UTC requires an up-to-date lookup table, while the possibility of out-of-order times can be accounted for in code. I think that's the reasoning behind it moreso than "math is hard".
> UTC and POSIX time are adjusted, relative to TAI, to keep the number of seconds in a given day at a nice "easy" 86400
yes, technically POSIX time is defined not as a number of seconds since epoch, but as 86400 * (number of days since epoch) + (number of seconds since last midnight)
Java hedges its bets. System.currentTimeMillis refers you to the docs for java.util time which states
"Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine."
and further down in notes on possible ranges of return values
"A second is represented by an integer from 0 to 61; the values 60 and 61 occur only for leap seconds and even then only in Java implementations that actually track leap seconds correctly. Because of the manner in which leap seconds are currently introduced, it is extremely unlikely that two leap seconds will occur in the same minute, but this specification follows the date and time conventions for ISO C."
At midnight on NYE 2008/9 we dialed up the speaking clock, and there actually was an extra beep. It was pretty cool, and we felt a brief moment of existential nausea when we suddenly felt our size in relation to the solar system.
(I'd like to point out that after that we did go to a massive party.)
This is definitely something you should worry about if you rolled any of your own time code. The POSIX standard is consistent across days, including leap seconds. That means that your Unix timestamp will jump back a second: it will go from 1341100800.9...[0] to 1341100800. If you're relying somewhere on seconds being continuous, or on a one-to-one mapping between timestamps and seconds, this could fuck things up.
Although 1341100800 refers to two seconds, when converting to UTC it should always become 00:00:00. Your implementation may not be conforming to the standard, though. Make sure to test.
(I'm sure if you rolled your own time code, you already know about this stuff. Probably other folks are curious though :)
[0] I think this is the second we're talking about, not positive though.
Me too. I'd be really interested to hear their story. Has anyone been involved with fixing a system that would have been provably broken by stuff like this (and other things like Y2K)?
Bonus points if you were working on critical public infrastructure like a nuclear power plant.
At least on Cisco systems, you can add a leap second [1], and at least on my network the tolerance is set at 5 minutes. So network time should still be working. For clients that might not know how to deal with a leap second but still poll network time, I only see issues in the rare case that the client polls the server at exactly 23:59:60. In that situation, they might poll back again to grab a new time thinking it's wrong.
Of course there will always be outliers and poorly coded applications that rely on time, but at least it's not a Y2K style situation.
Guys do the right thing. If your app is very sensitive to bad data (say financial) just throw up a temporary "down for quick maintenance" page for a couple of seconds and you are good to go.
Downtime affects SLAs and there isn't a lot of breathing room depending on your 9's[1]. In addition, bringing something down has its own problems and are you just advocating bringing down the user interface or should everything get shut down, like the entire stack? All the services, queues, databases, block storage, etc?
I think it would be an interesting PR campaign to ask people what they would do with 1 more second. if time is money, how much money do we inject when we add a second to the year?
Of course we wouldn't have this problem if we just counted seconds from some particular point in space time moving forward. Who cares if the Sun is exactly overhead at noon anyway :-)
Thank goodness I don't have to work on time anymore. Zulu time, sidereal_time, UTC, GPS Time... Phone calls from work at odd hours..
I do like GPS time. It keeps going at a constant rate like all good time should. Time differences are easier in GPS, you don't have to worry about pesky leap seconds....
Sidereal time is the most interesting from a cosmic sense.
A hackerish question: how can you take advantage of it? Say, in stocks or online transactions?
(I haven't got time to read the article right now (but will do in a week when I'm less busy) and have little to zero experience with times, so forgive me if it's something that's been discussed in the article. I'm just curious.)
Almost certainly not. Remember this happens about every 1½ years, so this has happened a few times recently. I cannot see how you could take advantage of it, since it's the sort of edge case that you'd presume the designers of stock markets would know about.
I received word through a listserve from the coastguard
http://cgls.uscg.mil/
Once you agree to the security whatever go to 'hosted groups.' I subscribe to 'Notice Advisory Navstar Users,' which issues reports about GPS updates. They notified us 30 May 2012.
Edit: acomjean looks to have a better source (but if you are looking to subscribe to the Local Notice to Mariners in your district, which I strongly encourage if you boat on the ocean, my links will get you there too!).
I wonder what the impact is on computers. Will your server know to add another second, or will it just lose sync and be one second off for the rest of times?
At least UNIX time is sane enough not to count this madness, so all time differences are objective; only one timestamp value will ambiguously mean (-1):60th and :00th second in UTC.
The document: http://transition.fcc.gov/ib/sand/irb/weritacrnc/archives/nc... tells implementers how to handle events around the leap second. There is some discussion in the ITU-T to all together remove the leap second (but that decision will be taken only before the next leap second).
I'm as big an astronomy geek as anyone else, but this is so pointless. Why bother wasting time and effort with this? Just let the discrepancies accumulate and adjust 6 seconds every 10 years or so. It would save everyone a little bit of effort, and you could make an event out of it.
If it only happens every 10 years, software developers are likely to forget about it. Hello a batch of crashing systems every 10 years. When it happens every 1.5 years there's a trickle effect - only systems introduced in the last 1.5 years will have trouble and developers are more likely to remember to factor it in.
What's the point of this adjustment? Currently there is an offset of -34 seconds between TAI and UTC and aftwards it will be -35. Seems pretty random to me...
You mean why it matters that we have leap seconds (it doesn't and they should be abolished) or why the news of it matters (because a 1000 crappy time implementations are going to walk off the end of buffers and do weird things) ?
Why was this down-voted? I agree with the poster, and as far as I see, I wake up and everyone's clock is 1 second wrong, why precisely should I give a frig about this and how is the world going to end or change due to the clock going from :59 to :00 instead of :60 or anything being a second out?
[+] [-] aphyr|14 years ago|reply
59.50 59.75 60.00 60.25 60.50 60.75 60.00
Or, if your clock implementation is not POSIX-compliant but follows Mills' paper instead:
59.50 59.75 60.00 59.25 59.50 59.75 60.00
It gets weird, though: since this information was only made available recently, your computer may not know the leap second exists. In that case, its upstream NTP servers will jump and the local ntpd will slew the clock smoothly over the discontinuity, IIRC.
OTOH, if your system is aware of the leap second and if you're using the system clock to calculate intervals (i.e. t2 - t1), expect possibly negative or zero intervals over this timeframe. If you're calculating rates over a roughly 1-second interval, divide-by-zero bugs are definitely possible.
On a related note, does anyone know what the Oracle and OpenJDK JVMs do with respect to System.currentTimeMillis? They claim it's number of seconds since the epoch, which would imply this timer will not encounter discontinuities. The only ways I can think of to achieve that are by reading the system clock state to look for the leap insert/del/doublecount flag, or read a copy of the leap second table.
[edit] You may be asking, "Why would anyone use a system of time in which two numbers could refer to the same instant, or one in which a given number could refer to no time at all? Why not use a time system in which you could subtract two times from each other to get the interval between them? Or hell, even a time system where time always increases, you know, so we could order events.
The closest thing we have to such a time scale is TAI (http://en.wikipedia.org/wiki/International_Atomic_Time), which is what most computer systems like to pretend their clocks are: "the number of seconds since an epoch".
UTC and POSIX time are adjusted, relative to TAI, to keep the number of seconds in a given day at a nice "easy" 86400, which is why we're in this mess. Given that it takes plenty of math to translate a number like 1339696998.435347 into a human-readable date, I think our computers should just be keeping TAI to begin with and make the whole process easier on ourselves; but so many systems assume UTC or POSIX time that we're stuck with it.
[+] [-] Cushman|14 years ago|reply
[+] [-] masklinn|14 years ago|reply
yes, technically POSIX time is defined not as a number of seconds since epoch, but as 86400 * (number of days since epoch) + (number of seconds since last midnight)
[+] [-] aardvark179|14 years ago|reply
"Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine."
and further down in notes on possible ranges of return values
"A second is represented by an integer from 0 to 61; the values 60 and 61 occur only for leap seconds and even then only in Java implementations that actually track leap seconds correctly. Because of the manner in which leap seconds are currently introduced, it is extremely unlikely that two leap seconds will occur in the same minute, but this specification follows the date and time conventions for ISO C."
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] vlisivka|14 years ago|reply
EDIT: Simple time torture script is added:
[+] [-] JonnieCache|14 years ago|reply
(I'd like to point out that after that we did go to a massive party.)
[+] [-] tazzy531|14 years ago|reply
http://googleblog.blogspot.com/2011/09/time-technology-and-l...
[+] [-] adamsmith|14 years ago|reply
[+] [-] Trufa|14 years ago|reply
[+] [-] rayanm|14 years ago|reply
[+] [-] jessriedel|14 years ago|reply
[+] [-] DanWaterworth|14 years ago|reply
[+] [-] Cushman|14 years ago|reply
Although 1341100800 refers to two seconds, when converting to UTC it should always become 00:00:00. Your implementation may not be conforming to the standard, though. Make sure to test.
(I'm sure if you rolled your own time code, you already know about this stuff. Probably other folks are curious though :)
[0] I think this is the second we're talking about, not positive though.
[+] [-] scorpion032|14 years ago|reply
[+] [-] Splines|14 years ago|reply
Bonus points if you were working on critical public infrastructure like a nuclear power plant.
Worst thing in recent history that I remember is the Zune's leap-year bug: http://en.wikipedia.org/wiki/Zune#First_generation
[+] [-] freehunter|14 years ago|reply
Of course there will always be outliers and poorly coded applications that rely on time, but at least it's not a Y2K style situation.
[1] http://www.cisco.com/en/US/tech/tk869/tk769/technologies_whi...
[+] [-] rmc|14 years ago|reply
[+] [-] heliodor|14 years ago|reply
[+] [-] IsTom|13 years ago|reply
[+] [-] 3pt14159|14 years ago|reply
[+] [-] btipling|14 years ago|reply
[1] http://en.wikipedia.org/wiki/High_availability#Percentage_ca...
[+] [-] ChuckMcM|14 years ago|reply
Of course we wouldn't have this problem if we just counted seconds from some particular point in space time moving forward. Who cares if the Sun is exactly overhead at noon anyway :-)
[+] [-] unknown|14 years ago|reply
[deleted]
[+] [-] acomjean|14 years ago|reply
I do like GPS time. It keeps going at a constant rate like all good time should. Time differences are easier in GPS, you don't have to worry about pesky leap seconds....
Sidereal time is the most interesting from a cosmic sense.
[+] [-] pooriaazimi|14 years ago|reply
(I haven't got time to read the article right now (but will do in a week when I'm less busy) and have little to zero experience with times, so forgive me if it's something that's been discussed in the article. I'm just curious.)
[+] [-] rmc|14 years ago|reply
[+] [-] TazeTSchnitzel|14 years ago|reply
[+] [-] bajsejohannes|14 years ago|reply
[+] [-] acomjean|14 years ago|reply
http://www.usno.navy.mil/USNO/time/master-clock/leap-seconds
they get if from IERS
http://www.iers.org/
They issue leap second guidance to about 1 year in the future. They adjust typically twice a year as needed (Jan 1 and July 1).
[+] [-] dhimes|14 years ago|reply
Edit: acomjean looks to have a better source (but if you are looking to subscribe to the Local Notice to Mariners in your district, which I strongly encourage if you boat on the ocean, my links will get you there too!).
[+] [-] SeoxyS|14 years ago|reply
[+] [-] mbq|14 years ago|reply
[+] [-] throwaway64|14 years ago|reply
[+] [-] vr000m|14 years ago|reply
[+] [-] mschalle|14 years ago|reply
[+] [-] rmc|14 years ago|reply
[+] [-] DrewChambersDC|14 years ago|reply
[+] [-] Angostura|14 years ago|reply
[+] [-] philf|14 years ago|reply
[+] [-] capkutay|14 years ago|reply
[+] [-] 27182818284|14 years ago|reply
[+] [-] oasisbob|14 years ago|reply
http://www.bbc.co.uk/news/science-environment-16625614
The parent link is to the authoritative Bulletin C, hard to imagine that it's wrong.
[+] [-] excuse-me|14 years ago|reply
Although it's always possible that the USA will unilaterally ignore cheese-eating surrender monkey time and adopt "freedom time"
[+] [-] cdooh|14 years ago|reply
[+] [-] excuse-me|14 years ago|reply
[+] [-] iRobot|14 years ago|reply