1
0
mirror of https://github.com/systemd/systemd.git synced 2025-02-09 13:57:42 +03:00

sleep: round up when calculating RTC sleep time

Paranoia: this way we know that when we wake up all timers are
definitely equal or ahead of what we expect them to be.
This commit is contained in:
Lennart Poettering 2018-10-24 12:48:56 +02:00
parent 033cea5c9d
commit d029a3a8ca

View File

@ -235,7 +235,7 @@ static int execute_s2h(usec_t hibernate_delay_sec) {
if (r < 0)
return r;
wake_time = original_time + (hibernate_delay_sec / USEC_PER_SEC);
wake_time = original_time + DIV_ROUND_UP(hibernate_delay_sec, USEC_PER_SEC);
r = rtc_write_wake_alarm(wake_time);
if (r < 0)
return r;