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

Guy Harris guy at alum.mit.edu
Tue Jul 13 05:02:41 UTC 2004


On Fri, Jul 9, 2004 at 09:53:06AM, Chris Richards wrote:
> I am in the process of upgrading the kernel version on a platform that I
> work on. I noticed that the time_t definition has been changed in the newer
> version of the OS. It used to be a simple "long". But it is now an "unsigned
> long".

At least as I read IEEE Std 1003.1, 2004 Edition, they just violated the
Single UNIX Specification; the sys/types.h page in that spec says

	Additionally:

		...

	   o size_t shall be an unsigned integer type.

		...

	   o time_t and clock_t shall be integer or real-floating types.

I infer from "size_t shall be an unsigned integer type" that "integer
type" means "signed integer type" as opposed to "unsigned integer type";
if that inference is correct, use of "unsigned long" would violate the
SUS.

Perhaps the platform in question isn't trying to conform to the SUS (and
perhaps earlier standards as well - they're at work, but I'm at home),
but by not doing so, they're violating the expectations of at least some
software, including (but not necessarily limited to) the Olson timezone
code.

> My question is: am I just using an obsolete version of the timezone source
> or should I just change the time_t typedef in the OS?

If you can, I'd change the time_t typedef in the OS.  Perhaps the
supplier of that platform is trying to fix the Y2.038K problem (putting
the problem off another 68 years or so), but, in doing so, they run the
risk of breaking some other software.



More information about the tz mailing list