LWN.net Logo

How to ensure monotonic nondecreasing time

How to ensure monotonic nondecreasing time

Posted Nov 29, 2006 17:19 UTC (Wed) by giraffedata (subscriber, #1954)
In reply to: How to ensure monotonic nondecreasing time by robbe
Parent article: Counting on the time stamp counter

I guess zooko alluded to leap seconds, where UTC stands still for (actually: jumps backwards by) a second.

Ah. That's probably it.

Except that UTC does not stand still or go backwards. When there's a leap second, UTC goes steadily forward from 23:59:59 to 23:59:60 and then to 00:00:00. Note that a UTC time of day is a tuple of numbers (year, month, day, hour, minute, second).

But the standard Linux time representation (a single number) does step backward at leap second time; it's defined that way to make it easy to compute UTC from it.

And I think zooko's statement that a programmer can't have a time that is both monotonically nondecreasing and correlates to a human time standard has to be qualified to the case that the time is represented by a single number. As long as you're willing to work with multiple numbers, two obvious ways are TAI + delta as you suggest, and just plain UTC.


(Log in to post comments)

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