aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDaniel O'Callaghan <danny@FreeBSD.org>1999-01-12 18:43:38 +0000
committerDaniel O'Callaghan <danny@FreeBSD.org>1999-01-12 18:43:38 +0000
commit02b1a04fd5e32ef73c7d1b57a0f47defe03bab0a (patch)
tree630f8866105dbe4ba3b9038f610a3399a053be26 /gnu
parent0189b9a1fde3dfb91e29153c43eb9d465a983d0a (diff)
Notes
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/tar/getdate.y15
1 files changed, 10 insertions, 5 deletions
diff --git a/gnu/usr.bin/tar/getdate.y b/gnu/usr.bin/tar/getdate.y
index cc415776917d..530ab7abc9e7 100644
--- a/gnu/usr.bin/tar/getdate.y
+++ b/gnu/usr.bin/tar/getdate.y
@@ -1,5 +1,5 @@
%{
-/* $Revision: 1.2 $
+/* $Revision: 1.3 $
**
** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
@@ -98,7 +98,7 @@ extern struct tm *localtime();
#if !defined(lint) && !defined(SABER)
static char RCS[] =
- "$Header: /home/ncvs/src/gnu/usr.bin/tar/getdate.y,v 1.2 1994/11/04 02:12:22 jkh Exp $";
+ "$Header: /home/ncvs/src/gnu/usr.bin/tar/getdate.y,v 1.3 1998/01/05 11:32:38 danny Exp $";
#endif /* !defined(lint) && !defined(SABER) */
@@ -613,11 +613,16 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
if (Year < 0)
Year = -Year;
- if (Year < 100)
+
+ /* Real horrible stuff here. Think of something better by 2037 */
+ if (Year > 37 && Year < 100)
Year += 1900;
+ else if (Year < 38)
+ Year += 2000;
+
DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
? 29 : 28;
- if (Year < EPOCH || Year > 1999
+ if (Year < EPOCH || Year > 2037 /* Code not valid past 2037 */
|| Month < 1 || Month > 12
/* Lint fluff: "conversion from long may lose accuracy" */
|| Day < 1 || Day > DaysInMonth[(int)--Month])
@@ -626,7 +631,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
for (Julian = Day - 1, i = 0; i < Month; i++)
Julian += DaysInMonth[i];
for (i = EPOCH; i < Year; i++)
- Julian += 365 + (i % 4 == 0);
+ Julian += 365 + (i % 4 == 0); /* Code not valid in 2100 */
Julian *= SECSPERDAY;
Julian += yyTimezone * 60L;
if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)