]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
local: cancel remaining correction after external step
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 12 May 2022 09:53:15 +0000 (11:53 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 16 May 2022 14:28:36 +0000 (16:28 +0200)
Instead of the generic clock driver silently zeroing the remaining
offset after detecting an external step, cancel it properly with the
slew handlers in order to correct timestamps that are not reset in
handling of the unknown step (e.g. the NTP local TX).

local.c
sys_generic.c

diff --git a/local.c b/local.c
index 80fb6ba980820525cf292eeac22c1856152633dd..b32d0c6bcdaa12a6a66f95aa9990ff2e8b9f51d9 100644 (file)
--- a/local.c
+++ b/local.c
@@ -563,6 +563,8 @@ void
 LCL_NotifyExternalTimeStep(struct timespec *raw, struct timespec *cooked,
     double offset, double dispersion)
 {
+  LCL_CancelOffsetCorrection();
+
   /* Dispatch to all handlers */
   invoke_parameter_change_handlers(raw, cooked, 0.0, offset, LCL_ChangeUnknownStep);
 
index 6e29ee2ac878d86a9877cd363188aa896e4a0dce..2e79a1b4109f710f9227d6251b57439e4c683367 100644 (file)
@@ -109,12 +109,7 @@ static void
 handle_step(struct timespec *raw, struct timespec *cooked, double dfreq,
             double doffset, LCL_ChangeType change_type, void *anything)
 {
-  if (change_type == LCL_ChangeUnknownStep) {
-    /* Reset offset and slewing */
-    slew_start = *raw;
-    offset_register = 0.0;
-    update_slew();
-  } else if (change_type == LCL_ChangeStep) {
+  if (change_type == LCL_ChangeStep) {
     UTI_AddDoubleToTimespec(&slew_start, -doffset, &slew_start);
   }
 }