forked from luck/tmp_suning_uos_patched
y2038: alarm: fix half-second cut-off
Changing alarm_itimer accidentally broke the logic for arithmetic
rounding of half seconds in the return code.
Change it to a constant based on NSEC_PER_SEC, as suggested by
Ben Hutchings.
Fixes: bd40a17576
("y2038: itimer: change implementation to timespec64")
Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
af3784689e
commit
b111df8447
|
@ -297,7 +297,7 @@ static unsigned int alarm_setitimer(unsigned int seconds)
|
|||
* better return too much than too little anyway
|
||||
*/
|
||||
if ((!it_old.it_value.tv_sec && it_old.it_value.tv_nsec) ||
|
||||
it_old.it_value.tv_nsec >= 500000)
|
||||
it_old.it_value.tv_nsec >= (NSEC_PER_SEC / 2))
|
||||
it_old.it_value.tv_sec++;
|
||||
|
||||
return it_old.it_value.tv_sec;
|
||||
|
|
Loading…
Reference in New Issue
Block a user