Linux "date" command ignores leap-seconds?

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Mon Jan 14 22:19:15 UTC 2013


  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.

-- 
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
I don't run "desktop environments"; I run useful applications
--
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