Mentor
- 15,791
- 10,675
One small 1.59 millisecond for man, too many leap seconds for mankind.
I agree as well.anorlunda said:Therefore, Meta concludes, we should simply "stop the future introduction of
leap seconds."
If some application needs to know the position of the Earth to this level of accuracy, being half-a-second off probably won't be good enough anyway, and would have to make local adjustments with or without leap seconds.The leap second was introduced in 1972 and since then 27 leap seconds have been added to UTC. - Wikipedia
It does exist, it's called International Atomic Time (TAI). UTC is derived from TAI and it is UTC that must keep track of its cumulative difference from TAI (currently 37 seconds), not the other way round.Algr said:I agree as well.
I'm surprised that something like an "Arbitrary Machine Time" (Defined as never having leap seconds, and not being connected to the rotation of the Earth.) doesn't already exist, as it would be a useful tool to keep track of all the leap seconds that have occurred in the past.
pbuk said:International Atomic Time (TAI). UTC is derived from TAI and it is UTC that must keep track of its cumulative difference from TAI
And it is naive views like that that cause the problems.Svein said:For us the implementers, the algorithm is clear:
Ours is not to decide why, ours is to implement according to the specifications.
- If NTP (or GPS or whatever) tells us that we should add a leap second, the last minute befor midnight should contain 61 seconds.
- If we are told that we should subract a leap second (or add a negative leap second), the last minute befor midnight should contain 59 seconds.
Difftime is not going to help, if timestamps are unexpectedly out of sequence it will still report time moving backwards.Vanadium 50 said:If you are using a well-vetted structure, like time_t, and well-vetted routines like difftime, what you suggest will work.
If time-keeping is mission critical it is absolutely essential that you bypass (any clock synchronised by) NTP and use a clock which measures (fractions of) seconds rather than the movement along an arbitrary non-monotonic scale.Vanadium 50 said:The difficulty seems to be that some code where time-keeping is missionm critical a) bypass NTP, and b) bypass the well-vetted and built-in functionality described above.
Which method for correcting the system clock on leap second should you choose? It depends on your applications. It they don't require the system time to be monotonic, use ntpd or chronyd in their default configuration. There will be a backward step, but the clock will be off only for one second. If the time must be monotonic and the requirements on its accuracy are not very strict, you can use ntpd with the -x option to slew the clock instead. With chronyd you can set the leapsecmode option set to slew. If there is also a requirement to keep the clocks on multiple systems close to each other, consider using chronyd configured with a smaller maximum slew rate. If that is not an option, you can run your own leap smearing NTP server with chronyd, but be careful to not mix it with other servers.
Thanks for sharing. Who could fail to read and digest all that? [SARCASM]pbuk said:Some discussion can be seen at
Oh if only that were true, unfortunately it is the opposite of what normally happens in mainstream operating systems which change the "real-time" clock to match UTC. In Linux systems this is generally done bySvein said:And, of course, you never change the real-time clock. What you change is the offset used in reporting the local time, just as you would change the offset when going to and from DST
ntpd which by default will rewind the clock by a second without even telling you.Or, for some of us Down Under, much faster than that. Our clocks go back an hour every year, and have been doing so for many years, and non of my electronic devices - digital radios, PVR, phones, Linux / Windows PCs - that use external time servers to sync have ever had a problem.Vanadium 50 said:Let it go for a couple millennia and we'll fix it when the next daylight savings time change comes around.
Leap seconds R.I.P. But the wait until 2035 sounds strange. Perhaps someone can interpret the following from the same article.https://arstechnica.com/science/202...-be-abandoned-by-2035-for-at-least-a-century/
A near-unanimous vote on Friday in Versailles, France, by parties to the International Bureau of Weights and Measures (BIPM in its native French) on Resolution 4 means that starting in 2035, the leap second, the remarkably complicated way of aligning the earth's inconsistent rotation with atomic-precision timekeeping, will see its use discontinued. Coordinated Universal Time, or UTC, will run without them until 2135. It was unclear whether any leap seconds might occur before then, though it seems unlikely.
The assumption is that within those 100 years, time-focused scientists (metrologists) will have found a way to synchronize time as measured by humans to time as experienced by our planet orbiting the Sun.
I gather it is the earliest date that could be agreed - the Russians wanted later (it appears that they believe, mistakenly, that leap seconds give GLONASS an advantage) whereas nearly everyone else wanted it sooner, ideally now. The resolution allows for it to be sooner, it is to be agreed in 2026, so all we need to do is not have any leap seconds before then and common sense will prevail (in BIPM? I'll not place any bets). See the extract below from the published resolutions: https://www.bipm.org/documents/2012...2022.pdf/281f3160-fc56-3e63-dbf7-77b76500990f.anorlunda said:But the wait until 2035 sounds strange.
The General Conference on Weights and Measures (CGPM)...
- decides that the maximum value for the difference (UT1-UTC) will be increased in, or before, 2035,
- requests that the CIPM consult with the ITU, and other organizations that may be impacted by this decision in order to
- propose a new maximum value for the difference (UT1-UTC) that will ensure the continuity of UTC for at least a century,
- prepare a plan to implement by, or before, 2035 the proposed new maximum value for the difference (UT1-UTC),
- propose a time period for the review by the CGPM of the new maximum value following its implementation, so that it can maintain control on the applicability and acceptability of the value implemented,
- draft a resolution including these proposals for agreement at the 28th meeting of the CGPM (2026),
anorlunda said:Leap seconds R.I.P. But the wait until 2035 sounds strange. Perhaps someone can interpret the following from the same article.
The assumption is that within those 100 years, time-focused scientists (metrologists) will have found a way to synchronize time as measured by humans to time as experienced by our planet orbiting the Sun.

Tom.G said:It sounds like they don't have a clue about appropriate implementation, and are hoping someone will come up with a "Bright Idea" by then.![]()
Ouch. That suggests that they might want a leap minute after a century of programmers being out of practice and having forgotten how to handle a leap.pbuk said:It has been suggested that after 100 years UTC may have drifted by up to a minute but
Well, why I think running code that hasn't been tested in a century is a bad idea, but one could turn it around: what happens if we wait a couple thousand years and use it to adjust daylight savings time?anorlunda said:That suggests that they might want a leap minute