From bb670432a66d7d40967e525c56373ef5a99e4d07 Mon Sep 17 00:00:00 2001 From: lazyze <52817840+lazyze@users.noreply.github.com> Date: Fri, 27 Jun 2025 14:07:37 +0800 Subject: [PATCH] fix: timer error accumulation not being reduced after compensation --- cyber/timer/timer.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/cyber/timer/timer.cc b/cyber/timer/timer.cc index 12ace5a1641..122063cb009 100644 --- a/cyber/timer/timer.cc +++ b/cyber/timer/timer.cc @@ -112,6 +112,7 @@ bool Timer::InitTimerTask() { TIMER_RESOLUTION_MS) >= accumulated_error_ms) { task->next_fire_duration_ms = task->interval_ms - execute_time_ms - accumulated_error_ms; + task->accumulated_error_ns -= accumulated_error_ms * 1e6; } else { task->next_fire_duration_ms = TIMER_RESOLUTION_MS; }