Linux "date" command ignores leap-seconds?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Jan 14 22:23:59 UTC 2013


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





More information about the Legacy mailing list