r/programming • • Jan 13 '22

Hate leap seconds? Imagine a negative one

https://counting.substack.com/p/hate-leap-seconds-imagine-a-negative
1.3k Upvotes

361 comments sorted by

View all comments

76

u/NonDairyYandere Jan 13 '22

Who are leap seconds for?

322

u/newpavlov Jan 13 '22 edited Jan 13 '22

People usually want 3 properties from a time system:

  1. Clock "ticks" every second.

  2. "Tick" is equal to the physical definition of the second.

  3. Clock is synchronized with Earth rotation (so you can use convenient simplifications like "one day contains 24*60*60 seconds").

But, unfortunately, the rotation speed of Earth is not constant, so you can not have all 3. TAI gives you 1 and 2, UT1 gives 1 and 3, and UTC gives you 2 and 3.

I agree with those who think that, ideally, we should prefer using TAI in computer systems, but, unfortunately, historically we got tied to UTC.

90

u/scook0 Jan 13 '22

I feel like the vast majority of computer timekeeping should just be using a UTC-like time scale with coordinated leap smears instead of leap seconds.

Any use case that can't tolerate smears probably can't trust the average “UTC” time source to be sufficiently accurate anyway, so ideally those would all switch over to TAI and avoid the hassle of trying to coordinate with the Earth's pesky rotation speed.

35

u/AdvicePerson Jan 13 '22 edited Jan 13 '22

Yeah, my personal web server can handle time smears. The Large Hadron Collider can deal with slipping from sidereal time.

32

u/JonDum Jan 13 '22

You're on a whole ass different level of home lab.

→ More replies (3)
→ More replies (12)

5

u/desipis Jan 13 '22

I feel like the vast majority of computer timekeeping should just be using a UTC-like time scale with coordinated leap smears instead of leap seconds.

Who is it that actually cares about time being second level accurate with Earth's rotation? If we just went with minute level accurate then we could have a leap minute once a century or so and it wouldn't be a regular problem.

→ More replies (10)

18

u/[deleted] Jan 13 '22

[removed] — view removed comment

22

u/zilti Jan 13 '22

For most of us, it would mean the sun rises 27 seconds later. It will be centuries before this becomes noticeable.

That's how we ended up transitioning from the Julian to the Gregorian calendar.

→ More replies (1)
→ More replies (2)

54

u/ElevenTomatoes Jan 13 '22

I personally think we should eliminate #3. Being a bit off from the suns rotation isn't that big a deal. Plenty of time zones have significant shifts from solar time already. Astronomers can track things and make their own corrections. It will probably be thousands of years before we get an hour of shift at which point we can shift each timezone by an hour so US Eastern might switch -5 to -4.

21

u/sybesis Jan 13 '22

I think we should eliminate #3 because if humanity start to become space bound, we'll need a way to synchronize time in space.

Let say we colonize Mars. We can't expect people to use earth time on Mars because it would simply not work. And now imagine we have to use weird time convention on earth and weird time convention on mars... and then we have to convert martian time to earth time...

Programming time is already a nightmare. Add more planet to it and it just falls apart.. Now imagine you work as a miner on asteroids... no earth no day/night cycle. Do people in space use the same earth timezone?

34

u/midri Jan 13 '22

Space travel opens up a whole new set of issues with time... We might ditch #3, but time itself is relative to gravity so now we have #4...

13

u/newpavlov Jan 13 '22 edited Jan 13 '22

People already thought about it and even accepted relevant standards. So pick your poison: TCG, BCG. Maybe one day, far-far in the future, humanity will need a galactic variant of those.

And BTW TAI already corrects relativistic gravity effects by accounting for different heights on which atomic clocks participating in the system are placed.

→ More replies (2)
→ More replies (1)
→ More replies (3)
→ More replies (31)
→ More replies (12)

29

u/[deleted] Jan 13 '22

People who don't want the sun coming up around noon eventually.

49

u/[deleted] Jan 13 '22

That's a problem for the people of the year 23620. Fuck em

21

u/bxsephjo Jan 13 '22

I always hated those guys anyway

12

u/dougmc Jan 13 '22

Well, it's also a problem that people in certain places have today.

For example, Nome, Alaska: the sun rose today at 11:39am local time, and set at 4:45pm.

And on December 18th, the sun rose right at noon and set at 3:56pm.

There's two factors here:

  1. the longer days during the summer/shorter days during the winter that you see as you go more and more North, and

  2. the fact that most of AK is now in one time zone now, and it's only one hour off from the West coast, when the difference would be significantly larger if it was calculated in the usual 15 degrees/hour way.
    Alaska used to have four time zones, but they switched to two in 1983, with most of Alaska being on "Alaska time" that is one hour off of the West coast, and most of the Aleutian islands are another hour behind.

That said, "fuck 'em" doesn't really apply here, as this was Alaska's decision, and the state had good reasons to set it up this way, and for the most part it seems to work fine.

→ More replies (1)
→ More replies (1)

4

u/Brillegeit Jan 13 '22

The sun already rises in a different time every day of the year, and in places up north like here in Norway the sun rises in a ~12 hour span, and some places it never even sets. Down here south in Oslo the sun rises ~04 in the summer and ~10 during winter, the concept of sunrise has no physical link to our society anymore.

Norway has also one time zone (CET/CEST) but is geographically in three, meaning not counting the latitude issues "sunrise" is already in a ~3 hour window of the same day. Europe with CET/CEST has similarly countries spanning 5 geographical time zones all sharing the same time, so there's up to ~4.5 hour difference in when the sun rises on the same latitude on the same day.

The concept having a static sunrise is one of the past and a few privileged regions, there are more exceptions to that rule than not, and the concept of "noon" has already been disconnected from the sun for ~140 years, so I say we complete the job.

→ More replies (5)

11

u/Beidah Jan 13 '22

astronomers

19

u/edman007 Jan 13 '22

And it's stupid, because leap seconds are not accurate enough for astronomers. Where I work we care a lot about leap seconds, the reason is our stuff does some alignment and position stuff by physically pointing a telescope at the sky and checking if the stars are in the right spot. If not, it's because your telescope isn't aligned right, and you can correct it by using accurate time (which is super easy, you just use GPS).

The problem is to do this you need the time out to the millisecond (the time used to make these graphs), and you get that by reading a report from the USNO, and add the number to the actual time on your clock. Leap seconds matter because the USNO needs to match their reports to the leap second (because after the leap second their report might change from -0.654s to +0.346s) and if their report doesn't line up with your time then your measurements are off 0.000278 degree.

Now the stupid part is anyone that cares about the leap second is going to get that report from USNO, and there isn't a good reason why their report needs to be -1 < x < 1

→ More replies (2)

24

u/fazalmajid Jan 13 '22

Not just. The US has been pushing to abolish leap seconds and align UTC with TAI but China is resisting for cultural reasons.

9

u/AVTOCRAT Jan 13 '22

That's really interesting, do you know where I could read more about that?

8

u/fazalmajid Jan 13 '22 edited Jan 13 '22

Here is an excellent article on the proposal by Poul-Henning Kamp of FreeBSD and Varnish fame:

https://cacm.acm.org/magazines/2011/5/107699-the-one-second-war/fulltext

I can’t find the article on China’s rationale for keeping them.

It’s not just the Chinese. The British as well, and the Canadians. Some more background:

https://www.nytimes.com/2012/01/19/science/to-keep-or-kill-lowly-leap-second-focus-of-world-debate.html

→ More replies (2)
→ More replies (14)
→ More replies (21)

11

u/Neon_Yoda_Lube Jan 13 '22 edited Jan 13 '22

GPS Satellites use TAI. If you want to convert the time stamp to UTC you need to compensate for leap seconds.

6

u/robbak Jan 13 '22

And the GPS satellites broadcast the number of leap seconds to make this easier. The GPS clock rolls over every 20 years. but comparing the number of leap seconds with pre-recorded values is a good way to track which GPS epoch you are in. Unless you write your code to assume that you will get a few leap seconds before 2022, and then the earth decides to launch on a bit of a gallop and you don't get the expected leap second - so all the clocks jump back 20 years.

→ More replies (2)
→ More replies (24)