]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
reference: fix adjusting of last reference update time
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 6 Jun 2014 09:19:03 +0000 (11:19 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 6 Jun 2014 09:31:43 +0000 (11:31 +0200)
The timestamp is in cooked time, it needs to be adjusted on all changes,
not only on step.

reference.c

index bdc8f7dee0fef940718586f2bd8558991c847b75..08648894b11bcc65ed9ef773bf28d0e438d9bd3b 100644 (file)
@@ -147,11 +147,13 @@ handle_slew(struct timeval *raw,
             LCL_ChangeType change_type,
             void *anything)
 {
+  double delta;
+
   if (change_type == LCL_ChangeUnknownStep) {
     last_ref_update.tv_sec = 0;
     last_ref_update.tv_usec = 0;
-  } else if (change_type == LCL_ChangeStep) {
-    UTI_AddDoubleToTimeval(&last_ref_update, -doffset, &last_ref_update);
+  } else if (last_ref_update.tv_sec) {
+    UTI_AdjustTimeval(&last_ref_update, cooked, &last_ref_update, &delta, dfreq, doffset);
   }
 }