From 173a1de90f4bfe545a1160f3f2fd2bdc641d1885 Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Mon, 19 Aug 1996 16:12:18 +0000 Subject: [PATCH] * Makefile.in: add target for datetest * getdate.y: accept dates after 1999 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8953 dc483132-0cff-0310-8789-dd5450dbe970 --- src/kadmin/cli/ChangeLog | 6 ++++++ src/kadmin/cli/Makefile.in | 4 ++++ src/kadmin/cli/getdate.y | 13 +++++++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/kadmin/cli/ChangeLog b/src/kadmin/cli/ChangeLog index 3c1547e6a..db9704921 100644 --- a/src/kadmin/cli/ChangeLog +++ b/src/kadmin/cli/ChangeLog @@ -1,3 +1,9 @@ +Mon Aug 19 12:11:27 1996 Barry Jaspan + + * Makefile.in: add target for datetest + + * getdate.y: accept dates after 1999 + Fri Aug 16 13:46:31 1996 Barry Jaspan * kadmin.c: update addprinc and modprinc usage diff --git a/src/kadmin/cli/Makefile.in b/src/kadmin/cli/Makefile.in index bd1c5bfa5..5136c450c 100644 --- a/src/kadmin/cli/Makefile.in +++ b/src/kadmin/cli/Makefile.in @@ -19,3 +19,7 @@ install:: clean:: $(RM) $(PROG).local $(PROG) $(OBJS) + +# for testing getdate.y +datetest: getdate.c + $(CC) -o datetest $(CFLAGS) $(LDFLAGS) $(LDARGS) -DTEST getdate.c diff --git a/src/kadmin/cli/getdate.y b/src/kadmin/cli/getdate.y index 975a819f5..e105d19e5 100644 --- a/src/kadmin/cli/getdate.y +++ b/src/kadmin/cli/getdate.y @@ -652,16 +652,17 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode) Year += 1900; DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 29 : 28; - if (Year < EPOCH || Year > 1999 - || Month < 1 || Month > 12 - /* Lint fluff: "conversion from long may lose accuracy" */ - || Day < 1 || Day > DaysInMonth[(int)--Month]) - return -1; + if (Year < EPOCH /* XXX DANGER! || Year > 1999 */ + || Month < 1 || Month > 12 + /* Lint fluff: "conversion from long may lose accuracy" */ + || Day < 1 || Day > DaysInMonth[(int)--Month]) + return -1; 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) && ((Year % 100 != 0) || + (Year % 400 == 0))); Julian *= SECSPERDAY; Julian += yyTimezone * 60L; if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0) -- 2.26.2