FW: Definition of time_t changed from signed to unsigned...

Paul Eggert eggert at CS.UCLA.EDU
Fri Aug 20 04:55:30 UTC 2004

```John Cowan <jcowan at reutershealth.com> writes:

> A count of UTC seconds since the Epoch is the same as a count of TAI
> seconds

Only if you are talking about broken-down labels for time.  But I was
talking about time expressed as a count of seconds.  For example, the
two adjacent real-time seconds with broken-down labels 1998-12-31
23:59:60 and 1999-01-01 00:00:00 UTC have the same count-of-seconds
since the epoch.

This is according to the official definition of UTC.
Here's an example of the official wording:

The difference between UTC and the International Atomic Time TAI is:

from 1997 July 1,    0h UTC, to 1999 January 1, 0h UTC  : UTC-TAI = - 31s
from 1999 January 1, 0h UTC, until further notice       : UTC-TAI = - 32s

This is a quote from IERS Bulletin C 16 (1998-07-17)
<http://hpiers.obspm.fr/eoppc/bul/bulc/bulletinc.16>.

Since TAI ticks along uniformly, and UTC-TAI jumps backwards by 1
second at the end of the inserted leap second, it logically follows
that UTC also jumps backward by 1 second at the same moment.

> POSIX time counts the number of non-leap seconds since the Epoch

Yes.  More precisely, POSIX time is defined by the following
C-language expression, for years>=1970 (i.e., tm_year >= 70):

tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
(tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400

Reference:
<http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap04.html#tag_04_14>

This equation says that the POSIX clock hops backward by 1 second
immediately after an inserted leap second (i.e., a second where tm_sec
== 60).  This is consistent with the official definition of UTC quoted
above.

```