4.2BSD asctime(3) dies on years>1999 - (nf)
Dave Martindale
dmmartindale at watcgl.UUCP
Mon Sep 3 05:09:24 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.
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
This fix works for years from 2000 to 2099, but blows up for years after 2100.
The original bug was due to missing paretheses. The correct fix is to
change the line in question to:
cp[2] = '0' + (t->tm_year >= 200);
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list