From: Miroslav Lichvar Date: Wed, 21 May 2014 15:36:51 +0000 (+0200) Subject: sys: use maximum timeout for offsets below minimum correction X-Git-Tag: 1.30-pre1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f88a712d01597c44dd4ddbc195dc1480cc0d72c9;p=thirdparty%2Fchrony.git sys: use maximum timeout for offsets below minimum correction 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. --- diff --git a/sys_generic.c b/sys_generic.c index 62a5a7cf..dabeea3e 100644 --- a/sys_generic.c +++ b/sys_generic.c @@ -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;