Definition of time_t changed from signed to unsigned...

Olson, Arthur David (NIH/NCI) olsona at
Thu Jul 15 16:30:41 UTC 2004

> -----Original Message-----
> From: Chris Richards [mailto:cj_richards at] 
> Sent: Tuesday, July 13, 2004 12:42 PM
> To: Olson, Arthur David (NIH/NCI)
> Subject: RE: Definition of time_t changed from signed to unsigned...
> Hi,
> Actually, could this be due to me using a tz.cfg database that was
> in an environment where time_t was typedef'ed differently to the
> which loads and uses the tz.cfg?

It certainly could be due to using a signed-system-generated data file on an
unsigned-time_t system.
Signed time values from before 1970 are negative numbers; on an unsigned
system they'll look like large positive numbers.
This means that for present-day time_t values the "t < sp->ats[0]" test will
be satisfied, the software will assume that it's dealing with a time
predating the first transition that's recorded, and the software will apply
"default" rules.

"localtime.c" could be jiggered to ignore pre-1970 transitions if (1) time_t
is unsigned and (2) a data file has been generated on a signed system (which
can be determined by seeing if the transition times are correctly sorted
from the perspective of the system on which the software is being run).
Given the notes on this mailing list about the inadvisability of unsigned
time_t's, such jiggering is of questionable value.


More information about the tz mailing list