From: Fleuria Date: Thu, 3 Apr 2025 13:18:38 +0000 (+0700) Subject: timer: Do not recalculate monotonic elapse time on clock change X-Git-Tag: v258-rc1~239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bed9d2587c852c6dad5b2959a6313c8590e5d6a6;p=thirdparty%2Fsystemd.git timer: Do not recalculate monotonic elapse time on clock change The only clock change that affects monotonic timers is suspend causing CLOCK_MONOTONIC to fall behind CLOCK_BOOTTIME. However, monotonic timers that use CLOCK_BOOTTIME are not intended to have their elapse time changed after a suspend. Hence condition the calculation of monotonic timers’ elapse times on the cause not being a clock change. Fixes #29245 --- diff --git a/src/core/timer.c b/src/core/timer.c index e283a97983f..a45e0c393fe 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -486,7 +486,8 @@ static void timer_enter_waiting(Timer *t, bool time_change) { assert_not_reached(); } - v->next_elapse = usec_add(usec_shift_clock(base, CLOCK_MONOTONIC, TIMER_MONOTONIC_CLOCK(t)), v->value); + if (!time_change) + v->next_elapse = usec_add(usec_shift_clock(base, CLOCK_MONOTONIC, TIMER_MONOTONIC_CLOCK(t)), v->value); if (dual_timestamp_is_set(&t->last_trigger) && !time_change &&