|
|
Subscribe / Log in / New account

Leaping seconds and looping servers

Leaping seconds and looping servers

Posted Jul 3, 2012 20:04 UTC (Tue) by kleptog (subscriber, #1183)
In reply to: Leaping seconds and looping servers by drag
Parent article: Leaping seconds and looping servers

Let me put it this way, if there were an option in the NTP server:

leap_second_handling = smear|strict

I'd use the 'smear' setting. Alternatively, if there was a syscall that gave me the TAI I might use that. But monotonic time is just one of those assumptions that creeps in very easily.

Interestingly, you could define a smeared time which would be mostly UTC but be convertible exactly to both UTC and TAI on demand. But for me monotonicity is the most important bit really.


to post comments

Leaping seconds and looping servers

Posted Jul 3, 2012 21:47 UTC (Tue) by lindi (subscriber, #53135) [Link] (5 responses)

Getting TAI time under GNU/Linux seems to be quite challenging. I came up with a rather hacky approach that seems to work: http://iki.fi/lindi/tai.c -- can you figure out how to clean that up?

Leaping seconds and looping servers

Posted Jul 4, 2012 18:49 UTC (Wed) by kleptog (subscriber, #1183) [Link] (1 responses)

Well, you can demonstrate it fairly easily on the command-line:
$ TZ="right/UTC" date ; TZ="posix/UTC" date
Wed Jul  4 18:26:24 UTC 2012
Wed Jul  4 18:26:49 UTC 2012
What you need is a library that can easily open multiple timezones at once. I thought glibc could do it, but it doesn't appear to, from reading the source. However, GLib seems to have support. I would have thought the g_time_zone_get_offset() would be enough, but apparently not. Actually, even though I can open both zones I can't convince GLib to give me the answer :(. Though it must be possible.

Leaping seconds and looping servers

Posted Jul 4, 2012 19:38 UTC (Wed) by lindi (subscriber, #53135) [Link]

Thanks for the pointer! If we had an easy way to get TAI I'd seriously consider using it in our internal systems since many parts already assume they can use simple substraction to get lengths of time intervals.

tai.c - why return t + 10?

Posted Jul 6, 2012 4:48 UTC (Fri) by pr1268 (guest, #24648) [Link] (2 responses)

Why return t + 10;?

I'm also curious about the curl braces creating a new scope but no if() / do / while() code.

I'm not trying to be critical; just a little curious...

tai.c - why return t + 10?

Posted Jul 6, 2012 5:43 UTC (Fri) by lindi (subscriber, #53135) [Link] (1 responses)

"1 January 1972 00:00:00 UTC was 1 January 1972 00:00:10 TAI exactly" -- http://en.wikipedia.org/wiki/Coordinated_Universal_Time

The new block was just for clarity.

why t + 10?

Posted Jul 8, 2012 1:53 UTC (Sun) by pr1268 (guest, #24648) [Link]

I was then going to ask why add ten seconds, but then I found out what the ten seconds were about (scroll down to the image titled "Time scales since the cesium atomic frequency standard").

Leaping seconds and looping servers

Posted Jul 4, 2012 9:40 UTC (Wed) by Tobu (subscriber, #24111) [Link]

Here's a little about libtai. lindi's approach is interesting as well since it uses the leap seconds table implicitly precent in Olson's tzdata, which is already regularly updated in stable distributions.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds