Linux "date" command ignores leap-seconds?

Eric B gyre-Ja3L+HSX0kI at public.gmane.org
Wed Jan 16 06:36:18 UTC 2013


On Tue, 15 Jan 2013, Lennart Sorensen 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.

Yes, unix timestamps do not account for leap seconds, BUT
that is inconsistent with the 'man date' documentation.

  $ man date
    ...
    %s  seconds since 1970-01-01 00:00:00 UTC

UTC has a specific scientific meaning which includes leap
seconds.  UTC is not linear.
Therefore the difference between two UTC timestamps must
include leap seconds.

If you ask how many seconds have elapsed since 1 January 1970 UTC,
the unix 'date' command gives the wrong answer.

Simple solution:  fix the man page.
ie:
  %s  seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds

--
Eric B.
--
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