The number of leap seconds required is determined by the Earth's rotation speed, which isn't constant. In the same way that an ice skater extending his arms slows down, shifts in mass on the Earth can alter its rotation speed. Earthquakes, icemelt, atmospheric warming, and even the filling of the Three Gorges Dam can have an effect at the scale required for GPS synchronization.
This isn't even really a GPS thing, it's UTC time that bounces around because it wants to stay synchronized to the day/night cycle. GPS time is continuous.
We decided to have leap seconds to match UTC which otherwise needn't care and could be based on TAI, against UT, which depends on the gentle spinning of the large rock we all live on.
The IERS https://www.iers.org/ is in charge of monitoring the spinning of the Earth. On the basis of their assessment a decision is made every six months whether to inject (or indeed remove) a leap second.
If we decided not to match UTC to UT and thus we did not care precisely how quickly or slowly the Earth is spinning, we could abolish leap seconds.
If you meant, "Why can't we precisely predict the motions of a vast rock floating in space years into the future" then I don't know what to tell you. We're not God?
> If you meant, "Why can't we precisely predict the motions of a vast rock floating in space years into the future" then I don't know what to tell you. We're not God?
IMO this feels like the more interesting one to explore: are leap seconds wholly from things that are within measurement error in existing rotation, or is the Earth's rotational rate actually changing? If we had leap minutes as the smallest increment, could we predict them out centuries in advance? etc
No, they are not measurement error. The moment of inertia of the earth changes over time in irregular ways (e.g, melting glaciers, etc). Even a major earthquake can show up in the earth’s rotation.
Leap seconds account for the accumulated difference in the rotational period from time to time.
Leap seconds correct for the difference between the time as measured by atomic clocks and the time determined by solar observations.
Turns out the rotation speed of Earth varies. Things like tides, earthquakes, and climate change can affect it. There is no formula for that, the only thing you can do is measure and issue a leap second when required.
> I don't think gpsd has any reason to be predicting when a future leap-second is going to occu
Until last year, leap seconds had been very predicable. The effect of global warming on earth rotational speeds was only very recently seen, or even predicted. But, yes, going forward, that needs to change.
> And the code in question is clearly expecting only positive leap-seconds.
Yes, because until 2020, the thought of a negative leap second was unthinkable. I would welcome you testing that and seeing what falls out.
It'd be cool if we could just invent a new standard time system that's independent from things like that which add variation or unexpected randomness.
I mean sure it would be annoying but its a one time change and our generation has to endure the pain of upgrading our systems, but it would be worth it no?
I'd be interested to hear how you're going to bring it into alignment with GMT and the other Sun-and-Earth-based measuring systems which people are actually going to want to use. Note that the solar day does vary unpredictably in length (https://en.wikipedia.org/wiki/Day_length_fluctuations).
It looks like it you would need to change the Earth's rotational energy by ~1.4*10^22 J to change the length of a mean solar day by 1/365 seconds (which would cause UTC to change by 1 second per year). If energy costs 1 cent per kilowatt hour, this is only around $40 trillion, which is much less than I was expecting.
If energy becomes a few orders of magnitude cheaper and someone knows a reasonable mechanism to put that energy into the earth's rotation, Google or someone similar might find it easier to keep days at 86400 seconds than to deal with leap seconds.
There's not really anything to invent or upgrade. Just never add any more leap seconds (the past ones can't be safely removed). We need to lobby the IERS harder.
Switching everyone from UTC to TAI is too much work and if you try to use TAI while everyone else is on UTC you'll run into off-by-37 bugs everywhere. It's better to keep using UTC but add no more leap seconds to it.
If people didn't need leap seconds, they would already not be using them. There's absolutely no use case for adding leap seconds for a few decades and then stopping. Either put them in or don't.
At the time leap seconds were introduced, it was much rarer for anyone to be able to tell (much less care) that someone on a another continent had a clock a few seconds off from theirs (and those who cared most were probably astronomers, which is why we ended up with leap seconds). There's a reasonable argument that the number of bugs (and extra work for programmers) now caused by them is enough that we should just stop adding them (and perhaps change time zones every few millennia).
Of course, the 'correct' way to fix it would be to use TAI rather than UTC just about everywhere, but that change would be hard to implement compared to just not adding more leap seconds.
Leap seconds are the right thing to do but people didn't realize all the bugs and costs they would trigger. Now that we understand these costs we can and should change our minds.
Well, leap something is arguably the right thing to do, but I'm not convinced that seconds are the best size. It's very possible that a leap minute every century or two would cause less disruption. It's also possible that making leaps a lot more frequent would cause less disruption, because good code is well-tested and oblivious code is less impacted.
Which actually makes the problem more disruptive as when it needs to be solved the solution has to be rediscovered rather than retained as it is with problems that are more frequent.
> If people didn't need leap seconds, they would already not be using them.
Google already don't. But I think they had to patch their kernels etc. to achieve that.
Leap seconds were a bad solution and we should remove them from general-purpose computer systems (some very specialised systems may need them). But it's a massive coordination problem and most people just don't care enough to change anything.
No, but it has most of the same advantages and disadvantages as just ignoring them. I would bet that the only reason they apply a smear rather than just ignoring the leap second entirely is to keep their clocks in sync with the outside world.
I believe we used to, but only recently have we began to understand that the Earth's rotation is not slowing down in a linear/predictable fashion. A comment on the bug says this has something to do with global warming, but I don't really have much context here.
In the same vain there is no algorithm to precisely predict moon phases. A complete cycle takes proximately 27 days but not really. To find out you have to look into the sky which can also be a bit subjective.