diff options
author | alex <alex@FreeBSD.org> | 1998-05-05 01:53:15 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 1998-05-05 01:53:15 +0000 |
commit | 25b5448723fb1b13c01109c64335a7b14cc0f924 (patch) | |
tree | a9987a35a53592e166ac817a772304fdc0ff041e /usr.bin/at/parsetime.c | |
parent | 9eefc374c7d2c2e136c65050188750bf3fa91e3f (diff) | |
download | FreeBSD-src-25b5448723fb1b13c01109c64335a7b14cc0f924.zip FreeBSD-src-25b5448723fb1b13c01109c64335a7b14cc0f924.tar.gz |
Permit double digit year values to be used in the next millenium.
Diffstat (limited to 'usr.bin/at/parsetime.c')
-rw-r--r-- | usr.bin/at/parsetime.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c index 6e64f1f..ec3ca60 100644 --- a/usr.bin/at/parsetime.c +++ b/usr.bin/at/parsetime.c @@ -131,7 +131,7 @@ static size_t sc_len; /* scanner - lenght of token buffer */ static int sc_tokid; /* scanner - token id */ static int sc_tokplur; /* scanner - is token plural? */ -static char rcsid[] = "$Id: parsetime.c,v 1.10 1997/06/23 06:44:18 charnier Exp $"; +static char rcsid[] = "$Id: parsetime.c,v 1.11 1997/06/24 06:26:32 charnier Exp $"; /* Local functions */ @@ -409,6 +409,22 @@ assign_date(struct tm *tm, long mday, long mon, long year) year -= 1900; else panic("garbled time"); + } else { + struct tm *lt; + time_t now; + + time(&now); + lt = localtime(&now); + + /* + * check if the specified year is in the next century. + * allow for one year of user error as many people will + * enter n - 1 at the start of year n. + */ + if (year < (lt->tm_year % 100) - 1) + year += 100; + /* adjust for the year 2000 and beyond */ + year += lt->tm_year - (lt->tm_year % 100); } if (year < 0 && |