/* Cancel remaining slew and make the step */
LCL_AccumulateOffset(correction, 0.0);
- if (!LCL_ApplyStepOffset(-correction))
+ if (!LCL_ApplyStepOffset(-correction)) {
+ /* Revert the correction */
+ LCL_AccumulateOffset(-correction, 0.0);
return 0;
+ }
LOG(LOGS_WARN, "System clock was stepped by %.6f seconds", correction);
if (step_offset != 0.0) {
if (LCL_ApplyStepOffset(step_offset))
LOG(LOGS_WARN, "System clock was stepped by %.6f seconds", -step_offset);
+ else
+ LCL_AccumulateOffset(step_offset, 0.0);
}
update_leap_status(leap, raw_now.tv_sec, 0);
check_source_selection || test_fail
check_packet_interval || test_fail
check_sync || test_fail
-check_chronyc_output "^.*Stratum *: 2.*$" || test_fail
+check_chronyc_output "^.*Stratum *: 2
+Ref time.*
+System time *: 0.000.*
+Last offset *: [+-]0.000.*$" || test_fail
+check_log_messages "Could not step" 0 0 || test_fail
+
+client_conf="makestep 0.01 -1"
+client_server_options="offset 5.0005"
+
+run_test || test_fail
+check_chronyd_exit || test_fail
+check_source_selection || test_fail
+check_packet_interval || test_fail
+check_sync || test_fail
+check_chronyc_output "^.*Stratum *: 2
+Ref time.*
+System time *: 5.000.*
+Last offset *: [+-]0.000.*$" || test_fail
+check_log_messages "Could not step" 20 60 || test_fail
test_pass