]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Better estimate RTC offset right after trim
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 13 Feb 2012 15:54:18 +0000 (16:54 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 13 Feb 2012 15:54:18 +0000 (16:54 +0100)
rtc_linux.c

index aa172e14d3c90e1b272db9b5bf34c5425df0516a..2395bb853437a28d526f622743339c1c3b00313c 100644 (file)
@@ -1045,9 +1045,10 @@ RTC_Linux_Trim(void)
     n_samples = 0;
     operating_mode = OM_AFTERTRIM;
 
-    /* Zero the offset in case writertc is called or chronyd
+    /* Estimate the offset in case writertc is called or chronyd
        is terminated during rapid sampling */
-    coef_seconds_fast = 0.0;
+    coef_seconds_fast = -now.tv_usec / 1e6 + 0.5;
+    coef_ref_time = now;
 
     /* And start rapid sampling, interrupts on now */
     if (timeout_running) {