]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys: use maximum timeout for offsets below minimum correction
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 21 May 2014 15:36:51 +0000 (17:36 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 22 May 2014 11:28:46 +0000 (13:28 +0200)
There is no need to try to correct offsets below the specified minimum
(1 nanosecond), let the clock drift away after crossing zero offset and
avoid unnecessary updates.

sys_generic.c

index 62a5a7cf6f10c7a0ad46dbfeddeace8c8832c10a..dabeea3e186b34c9ca104b03874c0aa310cffb0a 100644 (file)
@@ -160,7 +160,8 @@ update_slew(void)
      is zero or has wrong sign (e.g. due to rounding in the frequency driver or
      when base_freq is larger than max_freq), use maximum timeout and try again
      on the next update. */
-  if (offset_register * slew_freq <= 0.0) {
+  if (fabs(offset_register) < MIN_OFFSET_CORRECTION ||
+      offset_register * slew_freq <= 0.0) {
     duration = MAX_SLEW_TIMEOUT;
   } else {
     duration = offset_register / slew_freq;