summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authordanny <danny@FreeBSD.org>1999-01-13 06:31:55 +0000
committerdanny <danny@FreeBSD.org>1999-01-13 06:31:55 +0000
commit7570a5c9f7bd9a3d45d953cf52ef294c45c0d74d (patch)
tree08415a8208858d190b402bb96715968767e9e054 /gnu
parent3c957151d334c463eb5e1e118af59ae0c19c65f5 (diff)
downloadFreeBSD-src-7570a5c9f7bd9a3d45d953cf52ef294c45c0d74d.zip
FreeBSD-src-7570a5c9f7bd9a3d45d953cf52ef294c45c0d74d.tar.gz
MF22 - allow dates to 2069
Submitted by: Arjan de Vet <Arjan.deVet@adv.iae.nl>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/tar/getdate.y16
1 files changed, 9 insertions, 7 deletions
diff --git a/gnu/usr.bin/tar/getdate.y b/gnu/usr.bin/tar/getdate.y
index 530ab7a..63ac7f7 100644
--- a/gnu/usr.bin/tar/getdate.y
+++ b/gnu/usr.bin/tar/getdate.y
@@ -1,5 +1,5 @@
%{
-/* $Revision: 1.3 $
+/* $Revision: 1.2.8.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.3 1998/01/05 11:32:38 danny Exp $";
+ "$Header: /home/ncvs/src/gnu/usr.bin/tar/getdate.y,v 1.2.8.3 1999/01/13 06:27:34 danny Exp $";
#endif /* !defined(lint) && !defined(SABER) */
@@ -614,15 +614,17 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
if (Year < 0)
Year = -Year;
- /* Real horrible stuff here. Think of something better by 2037 */
- if (Year > 37 && Year < 100)
+ /* Might as well allow up to 2069, as the code below has
+ * never worked for dates prior to 1970.
+ */
+ if (Year > 69 && Year < 100)
Year += 1900;
- else if (Year < 38)
+ else if (Year < 70)
Year += 2000;
DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
? 29 : 28;
- if (Year < EPOCH || Year > 2037 /* Code not valid past 2037 */
+ if (Year < EPOCH || Year > 2069 /* Code not valid past 2069 */
|| Month < 1 || Month > 12
/* Lint fluff: "conversion from long may lose accuracy" */
|| Day < 1 || Day > DaysInMonth[(int)--Month])
@@ -631,7 +633,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); /* Code not valid in 2100 */
+ Julian += 365 + (i % 4 == 0); /* Not valid in 2100 - Not leap year */
Julian *= SECSPERDAY;
Julian += yyTimezone * 60L;
if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
OpenPOWER on IntegriCloud