Linux "date" command ignores leap-seconds?

William Porquet william-HPpJ5Ac2/Hg at public.gmane.org
Mon Jan 14 22:38:34 UTC 2013


IIRC, leap-seconds are added as needed by an independent origanization
to account for the slight lag of the earth's rotation around the sun.

http://en.wikipedia.org/wiki/Leap-second#Insertion_of_leap_seconds

Cheers,
W.

On 14 January 2013 17:23, Lennart Sorensen <lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org> wrote:
> On Mon, Jan 14, 2013 at 05:19:15PM -0500, Walter Dnes wrote:
>>   I'm not complaining, because I prefer it that way, but I just want to
>> check.  First, let's get the number of seconds between 1970/01/01 and
>> 2013/01/01, i.e. exactly 43 years.
>>
>> [d531][waltdnes][~] date +%s -u -d 2013-01-01
>> 1356998400
>>
>>   Next, divide by 86,400 (number of seconds in a day.
>>
>> [d531][waltdnes][~] echo $(( 1356998400 / 86400 ))
>> 15706
>>
>>   And confirm that this is an exact division with zero remainder.
>>
>> [d531][waltdnes][~] echo $(( 15706 * 86400 ))
>> 1356998400
>>
>>   Divide 15706 days by 365
>>
>> [d531][waltdnes][~] echo $(( 15706 / 365 ))
>> 43
>>
>>   Multiply by 365 to check the remainder
>>
>> [d531][waltdnes][~] echo $(( 43 * 365 ))
>> 15695
>>
>>   15706 - 15695 = 11.  This is due to 11 intervening leap years, i.e.
>> 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, and 2012.
>>
>>   So it all works out.  Is this supposed to continue, or are there any
>> plans to include leap seconds?  Right now, I'd prefer not to.
>
> I do not believe information on leap seconds is part of the timezone data,
> so there is nowhere to get this information from as far as I know.
>
> I think leap seconds are just to keep midnight at midnight and the
> historical effect of them is so small as to be generally irrelevant and
> is hence ignored.
>
> --
> Len Sorensen
> --
> 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



-- 
William Porquet, M.A. ☨ mailto:william-HPpJ5Ac2/Hg at public.gmane.orghttp://www.2038.org/
“Luck is what happens when preparation meets opportunity.” - Lucius
Annæus Seneca
--
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