]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
reference: schedule fallback drift even when synchronized
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 26 Mar 2015 11:32:00 +0000 (12:32 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 27 Mar 2015 09:37:54 +0000 (10:37 +0100)
After update to NTPv4 the synchronized status doesn't change when
sources are unreachable, start fallbackdrift timeout on reference update
too.

chrony.texi.in
reference.c

index 858920d181e7b683e0fa8bc57183b7d4fdb09155..f09244317c891725f2fe1120d51d632d7d5d199e 100644 (file)
@@ -1637,14 +1637,13 @@ the program exits.  (See the dumpdir command above).
 @subsection fallbackdrift
 Fallback drifts are long-term averages of the system clock drift
 calculated over exponentially increasing intervals.  They are used
-when the clock is unsynchronised to avoid quickly drifting away from
-true time if there was a short-term deviation in drift before the
-synchronisation was lost.
+when the clock is no longer synchronised to avoid quickly drifting
+away from true time if there was a short-term deviation in the drift
+before the synchronisation was lost.
 
-The directive specifies the minimum and maximum interval for how long
-the system clock has to be unsynchronised to switch between fallback
-drifts.  They are defined as a power of 2 (in seconds).  The syntax is
-as follows
+The directive specifies the minimum and maximum interval since last
+clock update to switch between fallback drifts.  They are defined as a
+power of 2 (in seconds).  The syntax is as follows
 
 @example
 fallbackdrift 16 19
@@ -1652,13 +1651,13 @@ fallbackdrift 16 19
 
 In this example, the minimum interval is 16 (18 hours) and maximum
 interval is 19 (6 days).  The system clock frequency will be set to
-the first fallback 18 hours after the synchronisation was lost, to the
+the first fallback 18 hours after last clock update, to the
 second after 36 hours, etc.  This might be a good setting to cover
 daily and weekly temperature fluctuations.
 
 By default (or if the specified maximum or minimum is 0), no fallbacks
-will be used and the clock frequency will stay at the last value
-calculated before synchronisation was lost.
+are used and the clock frequency changes only with new measurements from
+NTP, reference clocks or manual input.
 @c }}}
 @c {{{ generatecommandkey
 @node generatecommandkey directive
index ecd5871c4f7ce60b054abc6cfc838ad121104ae7..14c74636aa963aca68d7439fa9a815ff979ff020 100644 (file)
@@ -457,11 +457,12 @@ update_fb_drifts(double freq_ppm, double update_interval)
 static void
 fb_drift_timeout(void *arg)
 {
-  assert(are_we_synchronised == 0);
   assert(next_fb_drift >= fb_drift_min && next_fb_drift <= fb_drift_max);
 
   fb_drift_timeout_id = -1;
 
+  DEBUG_LOG(LOGF_Reference, "Fallback drift %d active: %f ppm",
+            next_fb_drift, fb_drifts[next_fb_drift - fb_drift_min].freq);
   LCL_SetAbsoluteFrequency(fb_drifts[next_fb_drift - fb_drift_min].freq);
   REF_SetUnsynchronised();
 }
@@ -1071,6 +1072,7 @@ REF_SetReference(int stratum,
   /* Update fallback drifts */
   if (fb_drifts) {
     update_fb_drifts(abs_freq_ppm, update_interval);
+    schedule_fb_drift(&now);
   }
 
   last_ref_update_interval = update_interval;