Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site watcgl.UUCP Path: utzoo!watmath!watcgl!dmmartindale From: dmmartindale@watcgl.UUCP (Dave Martindale) Newsgroups: net.bugs.4bsd Subject: Re: 4.2BSD asctime(3) dies on years>1999 - (nf) Message-ID: <3056@watcgl.UUCP> Date: Sun, 2-Sep-84 15:09:24 EDT Article-I.D.: watcgl.3056 Posted: Sun Sep 2 15:09:24 1984 Date-Received: Mon, 3-Sep-84 10:48:45 EDT References: <2089@pur-ee.UUCP> Organization: U of Waterloo, Ontario Lines: 29 #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@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);