Compare commits

...

2 Commits

Author SHA1 Message Date
Fleuria 35f47caf8d
Merge aeaeeb0d24 into edc49209f1 2025-04-18 06:06:46 +09:00
Fleuria aeaeeb0d24
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
2025-04-03 20:18:38 +07:00
1 changed files with 2 additions and 1 deletions

View File

@ -476,7 +476,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 &&