]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
loopfilter changes from Dave Mills
authorHarlan Stenn <stenn@ntp.org>
Tue, 29 Aug 2006 10:47:20 +0000 (06:47 -0400)
committerHarlan Stenn <stenn@ntp.org>
Tue, 29 Aug 2006 10:47:20 +0000 (06:47 -0400)
bk: 44f41b38loGiWhDvRV0DtSpm-hbfNg

ntpd/ntp_loopfilter.c

index 3dfafbe9c09e9999d13ec14bdb21a85b8e3256ec..ab7c1e030d38032a4d982f1ede2a53f035a30b4a 100644 (file)
@@ -540,14 +540,11 @@ local_clock(
         * clock, respectively.
         *
         * Important note: The kernel discipline is used only if the
-        * offset is less than 0.5 s, as anything higher can lead to
-        * overflow problems. This might occur if some misguided lad set
-        * the step threshold to something ridiculous. No problem; use
-        * the ntp discipline until the residual offset sinks beneath
-        * the waves.
+        * step threshold is less than 0.5 s, as anything higher can
+        * lead to overflow problems. This might occur if some misguided
+        * lad set the step threshold to something ridiculous.
         */
-       if (pll_control && kern_enable && fabs(clock_offset) < .5 &&
-           state != S_FREQ) {
+       if (pll_control && kern_enable && clock_max < 0.5) {
 
                /*
                 * We initialize the structure for the ntp_adjtime()
@@ -794,6 +791,14 @@ adj_host_clock(
        sys_rootdispersion += clock_phi;
 
 #ifndef LOCKCLOCK
+       /*
+        * If clock discipline is disabled or if the kernel is enabled,
+        * get out of Dodge quick.
+        */
+       if (!ntp_enable || mode_ntpdate || (pll_control &&
+           kern_enable && clock_max < 0.5))
+               return;
+
        /*
         * Declare PPS kernel unsync if the pps signal has not been
         * heard for a few minutes.
@@ -805,14 +810,6 @@ adj_host_clock(
                pps_control = 0;
        }
 
-       /*
-        * If NTP is disabled or ntpdate mode enabled or the kernel
-        * discipline is enabled, we have no business going further.
-        */
-       if (!ntp_enable || mode_ntpdate || (pll_control &&
-           kern_enable))
-               return;
-
        /*
         * Implement the phase and frequency adjustments. The gain
         * factor (denominator) is not allowed to increase beyond the