# [time-nuts] Leap Quirks

Chuck Harris cfharris at erols.com
Sun Jan 4 09:36:56 EST 2009

```One of us is confused about what time_t is... I think it is
you.

time_t is a 32 bit (depreciated), or 64 bit integer that contains
the number of seconds since the epoch.  It is not to be adjusted
for leap seconds according to POSIX, and unix convention.

Everything to do with UTC and leap seconds is a library function
in most unixes that translates the leap second free time_t into

Again, are you telling me that time_t is getting adjusted for leap
seconds?  If so, when did this change?

-Chuck Harris

Magnus Danielson wrote:
> Chuck Harris skrev:
>> Poul-Henning Kamp wrote:
>>> In message <495FD637.5030105 at erols.com>, Chuck Harris writes:
>>>
>>>> Ok, that is news to me.  Are you saying that (pulling a number out of
>>>> the air) time_t = 21120123 could be followed by 21120123 on a year where
>>>> we added a leap second?
>>> Apart from the number, that is exactly what happens: The last
>>> second of the (UTC) day is recycled twice.
>> As far as I remember, and as far as I can tell, what you are saying
>> violates both the unix and POSIX definition of time_t.
>>
>> So to check, I pulled out both of my K&R editions of "The C programming Language"
>> and I did a quick google on time_t, and all of the sources I have found
>> concur that time_t is the number of seconds since 1/1/1970 UTC without
>> regard to leap seconds.
>>
>> When did this change?
>
> Depends on which interpretation of POSIX you are making... how you "fit"
> your UTC time onto the POSIX scale.
>
> http://www.cis.udel.edu/~mills/leap.html
>
> If you want POSIX midnight to fit UTC midnight, then a piece-wise
> mapping must be maintained.
>
> Another way would be to just keep POSIX time as SI seconds (or UTC
> rubber until 1972 and SI from there on, which is more practical if you
> care about details) and solve the UTC issue "outside" the core. Which is
> fine too.
>
> Cheers,
> Magnus
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
>

```