diff --git a/src/control_vehicle.c b/src/control_vehicle.c index cc26c78..8f3a5ad 100644 --- a/src/control_vehicle.c +++ b/src/control_vehicle.c @@ -560,6 +560,15 @@ void control_loop(void) const double dt = now - last_time; const double dt_error = dt - expected_dt; last_time = now; + if (dt < 0) + { + yprintf( + OUTPUT_LV_ERROR, + "Detected system time jump back, monotonic time diff: %0.5fs, system time diff: %0.5fs\n", + expected_dt, dt); + static int status = EXIT_FAILURE; + pthread_exit(&status); + } if (dt_error < -p(YP_PARAM_MAX_TIME_JUMP_NEG, 0) || p(YP_PARAM_MAX_TIME_JUMP, 0) < dt_error) { yprintf(