Linux "date" command ignores leap-seconds?
Christopher Browne
cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Jan 15 17:17:24 UTC 2013
On Tue, Jan 15, 2013 at 11:36 AM, Lennart Sorensen
<lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> wrote:
> On Mon, Jan 14, 2013 at 10:08:13PM -0500, Bob Jonkman wrote:
>> Depends on what you're doing. Yes, the wall clock needs to stand still
>> for a second to keep up with Earth's rotation, but the timer that tells
>> me how long a process is running needs to keep running during a leap
>> second. If I ask how much time has elapsed since 1 January 1970 the
>> 'date' command appears to give the wrong answer by not counting the leap
>> seconds.
>>
>> Does it matter? Depends on what you're doing, and how accurate you need
>> to be.
>
> Well as far as I know the decision has been that unix timstamps do
> not account for leap seconds. So if you happen to care, you can't use
> unix timestamps without additional information and adjusting. Most things
> don't care, so keeping unix timestamps simple makes sense.
That being said, you should be able to figure out how many leap seconds have
occurred based on a given UNIX timestamp.
Actually, there's a pretty simple table:
<http://en.wikipedia.org/wiki/Leap_second>
Regrettably, it seems like some manual work to extract the data from
there; it would
be nice to have something like the TZ database for leap seconds.
--
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list