APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Unix time, UTC, TAI and all that.

Referencing: http://cr.yp.to/proto/utctai.html

People have this funny idea that time measurements should be reliable: 24 hours in a day, 365 days in a year, and so on. Of course the physical universe doesn't work that way: a year is slightly more than 365 days, a day is every so slightly longer than the number of seconds in 24 hours, so we need to adjust things now and then. A second is defined by Cesium radiation decay and that's TAI time, but if we used that for our clocks, we'd get slippage, so we use UTC time, which introduces leap seconds when needed. This keeps the Sun overhead at high noon, but is more than a small problem for computers.

It's not that computers can't set their time just as you set your watch, but programs that rely on doing something at specific intervals will of course be unreliable if time changes in mid-stream. Naturally, that could be upsetting: (from http://www.uwsg.iu.edu/hypermail/linux/kernel/9809.1/0219.html ):

.. proposed a similar solution:
gettimeofday() will not return during 23:59:60. If a process calls
gettimeofday() during a leap second, then the call will sleep until 0:00:00
when it can return the correct result.

This horrified the real-time people. It is, however, strictly speaking,
completely correct.
 

Unix time is based on seconds since Jan 1 1970, and of course every OS has some similar scheme. Microsoft takes its lumps on UTC leap seconds: DateTime - Not As Simple As You Think by Olav Lerflaten discusses .NET's issues on this subject.

There are proposals to fix the problem: Make NTP timestamps leap-second-neutral (like GPS time), and these of course generate lots of sometimes heated discussion.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Unix time, UTC, TAI and all that.




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Getting information off the Internet is like taking a drink from a fire hydrant. (Mitchell Kapor)

Tough times never last, but tough people do. (Robert H. Schuller)







This post tagged: