ctime(3C) funny on 3b2's

Kim Chr. Madsen kimcm at ambush.UUCP
Wed May 11 18:55:41 AEST 1988


Some experiments have revealed that there is a small bug (or feature)
in ctime(3C), it interprets its argument as a signed value. Or rather
the problem is that the type time_t is defined to be a signed long,
instead of an unsigned long.

This have the following effect:

	time = 2147480048   ==>  Tue Jan 19 03:14:07 GMT+1 2038
	time = 2147480049   ==>  Fri Dec 13 20:45:52 GMT+1 1901

So, if some of your programs must calculate times 50+ years into the
future don't rely on ctime.  Or you might end up with

			 Friday the 13th MCMI

Regards,

Kim Chr. Madsen, AmbraSoft A/S, Rojelskaer 15, DK-2840 Holte (Denmark)
UUCP: kimcm at ambush.dk, PHONE: +45 2424 111, FAX: +45 2423 090

Your old men shall dream dreams, your young men shall see visions. 
					-- The Bible, Joel, II:28



More information about the Comp.sys.att mailing list