From: Lennart Poettering Date: Wed, 24 Oct 2018 10:48:56 +0000 (+0200) Subject: sleep: round up when calculating RTC sleep time X-Git-Tag: v240~475^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d029a3a8ca9bdbf6ad6649a379c3d6757dd178ff;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index 91b52445e29..bd4c104ad07 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -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;