]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
reference: cook timestamp when setting reference
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Jun 2014 14:44:14 +0000 (16:44 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Jun 2014 14:58:41 +0000 (16:58 +0200)
This is a partial revert of 8aa9eb19c826f3ea4a9c2ce5e3a71b74aeeb99d0.
With the new generic driver cooking is cheap and it should be slighly
more accurate than reusing offset correction from the scheduler
timestamps.

reference.c

index 2d3c9cb02486012a9e726d777b1c0f4e25720755..80acc6ff1b323c6c48053711a146ddfb41f263ce 100644 (file)
@@ -791,7 +791,7 @@ REF_SetReference(int stratum,
   double elapsed;
   double correction_rate;
   double uncorrected_offset;
-  struct timeval now, raw_now, ev_now, ev_raw_now;
+  struct timeval now, raw_now;
 
   assert(initialised);
 
@@ -824,10 +824,7 @@ REF_SetReference(int stratum,
   }
     
   LCL_ReadRawTime(&raw_now);
-
-  /* This is cheaper than calling LCL_CookTime */
-  SCH_GetLastEventTime(&ev_now, NULL, &ev_raw_now);
-  UTI_DiffTimevalsToDouble(&uncorrected_offset, &ev_now, &ev_raw_now);
+  LCL_GetOffsetCorrection(&raw_now, &uncorrected_offset, NULL);
   UTI_AddDoubleToTimeval(&raw_now, uncorrected_offset, &now);
 
   UTI_DiffTimevalsToDouble(&elapsed, &now, ref_time);
@@ -998,9 +995,9 @@ REF_SetUnsynchronised(void)
     return;
   }
 
-  /* This is cheaper than calling LCL_CookTime */
-  SCH_GetLastEventTime(&now, NULL, &now_raw);
-  UTI_DiffTimevalsToDouble(&uncorrected_offset, &now, &now_raw);
+  LCL_ReadRawTime(&now_raw);
+  LCL_GetOffsetCorrection(&now_raw, &uncorrected_offset, NULL);
+  UTI_AddDoubleToTimeval(&now_raw, uncorrected_offset, &now);
 
   if (fb_drifts) {
     schedule_fb_drift(&now);