# # Unix time, UTC, TAI and all that.
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Unix time, UTC, TAI and all that.

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© June 2004 Tony Lawrence

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.


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





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

Printer Friendly Version

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


Inexpensive and informative Apple related e-books:

Digital Sharing Crash Course

Take Control of Apple Mail, Third Edition

Photos: A Take Control Crash Course

Take Control of High Sierra

El Capitan: A Take Control Crash Course





More Articles by © Tony Lawrence



Related Articles




Printer Friendly Version


Related Articles

Have you tried Searching this site?

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


Printer Friendly Version





Software engineering is the part of computer science which is too difficult for the computer scientist. (Friedrich Bauer)




Linux posts

Troubleshooting posts


This post tagged:

Blog

Kernel

Networking



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode