]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, refclock_acts.c:
authorHarlan Stenn <stenn@ntp.org>
Wed, 5 Apr 2000 05:44:37 +0000 (05:44 -0000)
committerHarlan Stenn <stenn@ntp.org>
Wed, 5 Apr 2000 05:44:37 +0000 (05:44 -0000)
  * 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

ChangeLog
ntpd/refclock_acts.c

index aba383d83f87d44833758085f2fcf075e25ceefb..23bc883d2b10449dad2b095a5632eb9d1bb27b43 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-04-05  Harlan Stenn  <stenn@whimsy.udel.edu>
+
+       * 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  <stenn@whimsy.udel.edu>
 
        * ntpd/refclock_atom.c (atom_pps): Bugfix
index 9c367b52abe8a867d1d8445731f56aba47fa9893..37be00709f66778e5fe8410e7b98f893e97b7622 100644 (file)
@@ -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;