>Is difftime() required to know about leap seconds and provide an accurate
>result?
No. It's not required, and most hosts don't do it.
Arguably, POSIX.1 forbids it.
Yes, quite, except that I would have said "INarguably, POSIX.1 forbids it."
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email: nm...@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
Isn't that a bit like the famous Indiana State Legislature and pi incident?
The truth[1] is that there are occasionally 86401 seconds in a day, and even
more rarely 86402 [Though I have never seen a double leap second, it is
supposed to be allowed].
[1] Also mandated by international standards bodies, specifically
coordinated universal time (UCT) mandates this.
The "double leap second" is complete nonsense. It never existed outside the
ANSI C standard and never will. It was introduced by the ANSI C 89 committee
to document its problems understanding UTC issues. Someone heard that there
are two prefered dates for leap seconds per year and this got munched up to
the false rumour that UTC days can be up to 86402 seconds long. The
definition of UTC, which requires that |UTC-UT1| < 0.9 s all the time,
obviously makes double leap seconds mathematically impossible.
Highly recommended reading:
Original references (the official UTC definition and an excellent
paper about UTC):
http://www.cl.cam.ac.uk/~mgk25/volatile/ITU-R-TF.460-4.pdf
http://www.cl.cam.ac.uk/~mgk25/volatile/astronomical-time.pdf
Detailed proposal for a C API that handles leap seconds correctly (and
fixes many other problems in <time.h>):
http://www.cl.cam.ac.uk/~mgk25/c-time/
Markus
--
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org, home page: <http://www.cl.cam.ac.uk/~mgk25/>