4.2BSD asctime(3) dies on years>1999 - (nf)
davy at ecn-ee.UUCP
davy at ecn-ee.UUCP
Sun Aug 26 08:17:05 AEST 1984
#N:ecn-ee:16700006:000:566
ecn-ee!davy Aug 25 15:39:00 1984
Subject: asctime(3) dies on years > 1999
Index: /usr/src/lib/libc/gen/ctime.c 4.2BSD
Description:
The asctime() routine will die on dates after Dec 31 23:59:59 1999,
producing a string with an incomplete year.
Repeat-By:
#include <sys/time.h>
main()
{
char *ctime();
long clock = 946702800; /* or anything greater */
printf("Next line should be: Sat Jan 1 00:00:00 2000\n");
printf("%s", ctime(&clock));
}
Fix:
On line 292, change:
cp[2] = '0' + t->tm_year >= 200;
to:
cp[2] = '0';
--Dave Curry
decvax!pur-ee!davy
eevax.davy at purdue
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list