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
This commit is contained in:
Fleuria
2025-06-27 14:45:02 +02:00
committed by Lennart Poettering
parent d63c8ce020
commit bed9d2587c
+2 -1
View File
@@ -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 &&