Allow two digit years 1969-2068

This commit is contained in:
danny 1999-01-18 22:15:09 +00:00
parent a1900b30e4
commit 43ca38ea1c

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
"$Id$";
"$Id: util.c,v 1.6 1998/03/23 07:41:49 charnier Exp $";
#endif /* not lint */
#include <sys/types.h>
@ -115,9 +115,12 @@ atot(p, store)
year = atoi(t);
if (day < 1 || day > 31 || month < 1 || month > 12 || !year)
goto bad;
if (year < 100)
/* Allow two digit years 1969-2068 */
if (year < 69)
year += 2000;
else if (year < 100)
year += 1900;
if (year <= 1970)
if (year < 1969)
bad: return (1);
lt->tm_year = year - 1900;
lt->tm_mon = month - 1;