]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Fix writing rtc data when called soon after trimrtc
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 14 Sep 2011 16:01:31 +0000 (18:01 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 14 Sep 2011 16:03:01 +0000 (18:03 +0200)
rtc_linux.c

index 2308cc8fc4c0cd4717c2182ded1f8f69eb021531..3ee8b66f8e9c5befa3cad154c77689268464e435 100644 (file)
@@ -695,6 +695,7 @@ handle_relock_after_trim(void)
     LOG(LOGS_WARN, LOGF_RtcLinux, "Could not do regression after trim");
   }
 
+  coefs_valid = 0;
   n_samples = 0;
   n_samples_since_regression = 0;
   operating_mode = OM_NORMAL;
@@ -1044,6 +1045,10 @@ RTC_Linux_Trim(void)
     n_samples = 0;
     operating_mode = OM_AFTERTRIM;
 
+    /* Zero the offset in case writertc is called or chronyd
+       is terminated during rapid sampling */
+    coef_seconds_fast = 0.0;
+
     /* And start rapid sampling, interrupts on now */
     if (timeout_running) {
       SCH_RemoveTimeout(timeout_id);