From: Harlan Stenn Date: Wed, 5 Apr 2000 05:44:37 +0000 (-0000) Subject: ChangeLog, refclock_acts.c: X-Git-Tag: NTP_4_0_99_J~45 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32263d3aa467adafa1a8ff81474cb6d5ac6b4602;p=thirdparty%2Fntp.git ChangeLog, refclock_acts.c: * ntpd/refclock_acts.c (acts_receive): Do a better job with year conversions and leap-year checks. The PTB stuff caught this. Reported by: Daniel.Aeby@eam.admin.ch bk: 38ead2c5UMTogbUynSRAhA8-4Otq6g --- diff --git a/ChangeLog b/ChangeLog index aba383d83f..23bc883d2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-04-05 Harlan Stenn + + * ntpd/refclock_acts.c (acts_receive): Do a better job with year + conversions and leap-year checks. The PTB stuff caught this. + Reported by: Daniel.Aeby@eam.admin.ch + 2000-04-02 Harlan Stenn * ntpd/refclock_atom.c (atom_pps): Bugfix diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c index 9c367b52ab..37be00709f 100644 --- a/ntpd/refclock_acts.c +++ b/ntpd/refclock_acts.c @@ -655,19 +655,22 @@ acts_receive ( (void)write(pp->io.fd, &flag, 1); /* - * Yes, I know this code incorrectly thinks that 2000 is a leap - * year. The ACTS timecode format croaks then anyway. Life is - * short. Would only the timecode mavens resist the urge to - * express months of the year and days of the month in favor of - * days of the year. - * NOTE: year 2000 IS a leap year!!! ghealton Y2KFixes + * The ACTS timecode format croaks in 2000. Life is short. + * Would only the timecode mavens resist the urge to express months + * of the year and days of the month in favor of days of the year. */ if (month < 1 || month > 12 || day < 1) { refclock_report(peer, CEVNT_BADTIME); return; } - if ( pp->year <= YEAR_PIVOT ) pp->year += 100; /* Y2KFixes */ - if ( !isleap_tm(pp->year) ) { /* Y2KFixes */ + + /* + * Depending on the driver, at this point we have a two-digit year + * or a four-digit year. Make sure we have a four-digit year. + */ + if ( pp->year < YEAR_PIVOT ) pp->year += 100; /* Y2KFixes */ + if ( pp->year < YEAR_BREAK ) pp->year += 1900; /* Y2KFixes */ + if ( !isleap_4(pp->year) ) { /* Y2KFixes */ if (day > day1tab[month - 1]) { refclock_report(peer, CEVNT_BADTIME); return;