News for hackers. Stuff that matters.
Re:Some DNS lookups causing 5xx errors due to leap second bug by gamegoblin on Saturday December 31, 2016 @11:51PM (#13294740)
I guessed most big services would be using something akin to time smearing [1] since the first big leap-second outages years ago. Is there any reason why cloudfare would be unable to use this technique?

[1] https://developers.google.com/time/smear

Re:Some DNS lookups causing 5xx errors due to leap second bug by wyager on Sunday January 01, 2017 @12:47AM (#13294834)
It's pretty lame that a lot of software is so fragile that it breaks if we give it the correct time.

The solution here is that any software that relies on accurate timing and/or breaks when you change the time should be using epoch seconds, not any sort of human-oriented time format.

Re:Some DNS lookups causing 5xx errors due to leap second bug by rspeer on Sunday January 01, 2017 @12:49AM (#13294838)
Leap seconds are a change to the number of UTC epoch seconds.
Re:Some DNS lookups causing 5xx errors due to leap second bug by wyager on Sunday January 01, 2017 @12:52AM (#13294844)
> Leap seconds are a change to the number of UTC epoch seconds.

UTC is different from epoch time. Epoch time by definition does not count leap seconds. https://en.m.wikipedia.org/wiki/Unix_time

Re:Some DNS lookups causing 5xx errors due to leap second bug by nshepperd on Sunday January 01, 2017 @08:23AM (#13295654)
"Does not count leap seconds" has to win some kind of award for misleading terminology. I'd wager it's responsible for a significant portion of leap second bugs due to confusion & misunderstanding about what Unix time is:

It sounds like what it means is that Unix time counts the number of real, actual, by-the-clock seconds that have passed since the epoch. That would be logical. But what it actually means is that it counts the number of real, actual, by-the-clock seconds, minus the number of those those that have been designated "leap seconds".

That is to say, whenever a "leap second" occurs, the nice monotonic isotonic progress of unix time is mutilated by suddenly adding or removing 1 to the total count so far. That's what "does not count leap seconds" means, and sometimes even what "ignores leap seconds" means (which is of course even worse terminology).

Re:Some DNS lookups causing 5xx errors due to leap second bug by wyager on Sunday January 01, 2017 @12:54PM (#13296521)
Shit, you're right. It had me totally fooled.
Re:Some DNS lookups causing 5xx errors due to leap second bug by zerd on Sunday January 01, 2017 @02:18AM (#13294980)
But it is affected by leap seconds. According to the example labeled "Unix time across midnight when a UTC leap second was inserted on 1 January 1999" the unix time went backwards. So using epoch/unix time does not help.
Re:Some DNS lookups causing 5xx errors due to leap second bug by EGreg on Sunday January 01, 2017 @02:21AM (#13294986)
Is it safe to say that time() in php and Date.now() in JS do not care about leap seconds?
Re:Some DNS lookups causing 5xx errors due to leap second bug by perennate on Sunday January 01, 2017 @02:26AM (#13294991)
From [1], it is likely messier than that:

> The time() function will resolve to the system time of that server. If the server is running an NTP daemon then it will be leap second aware and adjust accordingly. PHP has no knowledge of this, but the system does.

> It took me a long time to understand this, but what happens is that the timestamp increases during the leap second, and when the leap second is over, the timestamp (but not the UTC!) jumps back one second.

[1] http://stackoverflow.com/questions/7780464/is-time-guarantee...

Re:Some DNS lookups causing 5xx errors due to leap second bug by EGreg on Sunday January 01, 2017 @02:42AM (#13295018)
It would seem much simpler to just use TAI for timestamps, and get civil datetimes from UTC. Why didn't people do this? Why use UTC for timestamps??
Re:Some DNS lookups causing 5xx errors due to leap second bug by rspeer on Sunday January 01, 2017 @02:59AM (#13295048)
That doesn't seem simpler at all.

- UTC timestamps can unambiguously refer to times years in the future; TAI timestamps cannot, because it is unknown how many seconds will be in each year.

- Converting UTC timestamps to human-readable UTC times is simple modular arithmetic. A beginner in any programming language can do it. Converting TAI to UTC requires a lookup table, and it must be updated after the software is released.

What would be simpler would be ending the use of leap seconds for a millennium or so.

Re:Some DNS lookups causing 5xx errors due to leap second bug by nshepperd on Sunday January 01, 2017 @04:14AM (#13295197)
TAI timestamps can unambiguously refer to times years in the future. You can subtract the TAI timestamp from the current time, set an alarm for that number of seconds and it will actually occur on cue.

TAI timestamps don't refer unambiguously to UTC timestamps or calendar dates in the future, because the latter two depend on the variable rotation of the earth and (for zoned times) geopolitical whimsy.

I don't see why this matters though - most "timestamps" are for events in the past. The proper representation for events in the future will depend on your application (eg. are you writing a calendar for humans, or a spacecraft guidance system - does the event happen at a fixed point in time or a fixed point in the human work day?).

Re:Some DNS lookups causing 5xx errors due to leap second bug by rspeer on Sunday January 01, 2017 @04:56AM (#13295273)
Think through your proposal to track all times in TAI and then convert them for display. What TAI time do you pick to represent the time that will be displayed as "00:00:00 on January 1, 2020"? Are you going to be okay with it changing to "23:59:58 on December 31, 2019" due to the geopolitical whimsy you mention? What if you just wanted it to represent the day "January 1, 2020"? Do you not use timestamps for anything but exact seconds anymore?

UTC doesn't know how long a second is, and TAI doesn't know how long a day or a year is. But most people need to specify "10 years from now" more often than they need to specify "300 megaseconds from now".

Banning leap seconds would be fine. UTC leap seconds are messy but at least we get by. But updating all time conversion software (instead of just updating authoritative clocks) every time there's a leap second is ludicrous.

It's true that applications should use the proper representation for what they're intended to do. And they do. Most applications use UTC because they describe human-centric events. Astronomers use TAI.

Re:Some DNS lookups causing 5xx errors due to leap second bug by phicoh on Sunday January 01, 2017 @06:22AM (#13295425)
"00:00:00 on January 1, 2020" UTC is a rather useless timestamp for most practical purposes, unless you live close to th zero meridian. In most places you want to talk about 00:00:00 on January 1, 2020 localtime, which depends on what timezone you are in, and of course the daylight savings rules. Both can change. In some countries, daylight seems to be even more random than leap seconds.

In my opinion, the real problem is that TAI is not an option in most current systems. There is no way to get the time in TAI, no way to convert between TAI and UTC etc.

So even in applications where it makes sense to use TAI (think logging and billing) we don't do that because the necessary infrastructure is not available.

I think it is time that the technical community gets together can make TAI a first class citizen.

TAI doesn't help with timestamps in the future, but usually those applications don't need second level granularity anyhow. The applications that break during a leap second are the ones that need to track the current time or passage of time with sub-second accuracy. And those can be served perfectly with TAI.

Re:Some DNS lookups causing 5xx errors due to leap second bug by nshepperd on Sunday January 01, 2017 @08:16AM (#13295635)
"00:00:00 on January 1, 2020, local time", if it is to represent a calendar event in the human work day in the future, should be represented as neither a TAI "timestamp" nor a UTC "timestamp", but as a data type containing exactly "00:00:00 on January 1, 2020, local time".

> But updating all time conversion software (instead of just updating authoritative clocks) every time there's a leap second is ludicrous.

All time conversion software is already updated every time a government changes a time zone - by downloading the most recent tzdata. All software that needs second-level granularity is constantly updated, by synchronizing with NTP. There's nothing at all ludicrous about distributing leap second tables instead of mutilating the NTP time signal.

Re:Some DNS lookups causing 5xx errors due to leap second bug by userbinator on Sunday January 01, 2017 @03:32AM (#13295112)
"- UTC timestamps can unambiguously refer to times years in the future; TAI timestamps cannot, because it is unknown how many seconds will be in each year."

Isn't it the other way around, since TAI has no leap seconds?

"What would be simpler would be ending the use of leap seconds for a millennium or so."

That effectively means using TAI consistently, which is what software not aware of leap seconds would be doing anyway (despite the fact that it's actually working with UTC.)

Re:Some DNS lookups causing 5xx errors due to leap second bug by rspeer on Sunday January 01, 2017 @04:58AM (#13295278)
TAI has no leap seconds, but years, as currently defined, do.

And yes, I'm advocating for changing that definition, and making UTC a constant offset from TAI that works the same as TAI for the foreseeable future.

Re:Some DNS lookups causing 5xx errors due to leap second bug by EGreg on Sunday January 01, 2017 @09:58AM (#13295915)
Read what I wrote carefully. For things that you need to convert to human-readable dates, by all means use UTC.

But for timestamps that can be used to obtain a time difference between them, TAI should be readily available to be used. Most timestamps are for figuring out time differences here on Earth and not relative to astrological signs, they are for knowing what came before what, etc. They are not for generating human-readable dates. It's silly that such a major use case is hardly implemented on major systems, and instead an unreliable Unix Time is used which can "at any moment" have the same second twice.

Re:Some DNS lookups causing 5xx errors due to leap second bug by dingaling on Sunday January 01, 2017 @05:25AM (#13295340)
And alternatively I guessed that big services like Cloudflare, responsible for fronting 2.5 million websites, would have been running a preproduction environment clocked-forward to 2017.