There are always 60 seconds in a minute, 60 minutes in
an hour, 24 hours ina day... *always*. There is no "leap second" added at
any time or any placeon earth.
I know, leap seconds are a pain in the ass. When someone
use a time library, he must know the conditions in which
he can use it. I mean, if the library handles leap
seconds, and how it copes with them. The number of ticks
for a given date could change if leap seconds are
accounted for.
UTC is now quite the reference for civil time, and it is
based on atomic clock, more accurate than the period of
rotation of earth, which varies slightly and is not as
periodic as it should be.
From
http://www.npl.co.uk/time/leap_second.html, we have
an example:
1998 December 31 23h 59m 58s
1998 December 31 23h 59m 59s
1998 December 31 23h 59m 60s (here, leap second inserted)
1999 January 01 00h 00m 00s
1999 January 01 00h 00m 01s
In C and Java, and certainly lots of other languages,
leap seconds are taken into account, if the underlying OS
support it.
Quoting from the Java Language Specification about class
java.util.Date:
"A second is represented by an integer from 0 to 61. The
values 60 and 61 will occur only for leap seconds, and
even then only in Java implementations that actually
track leap seconds correctly. Because of the manner in
which leap seconds are currently introduced, it is
extremely unlikely that two leap seconds will occur in
the same minute, but this specification follows the date
and time conventions for ISO C."
Same problem about C. Quoting from any libc reference:
struct tm: This is the data type used to represent a
broken-down time.
int tm_sec: This is the number of full seconds since the
top of the minute (normally in the range 0 through 59,
but the actual upper limit is 60, to allow for leap
seconds if leap second support is available).
http://tycho.usno.navy.mil/leapsec.html http://www.leapsecond.com/java/gpsclock.htm
Any other suggestion ?