Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
syscalls/timer_settime01: Avoid rounding from nsec to usec
When using TIMER_ABSTIME, the value is added to the current clock time. However, usecs is used instead of nsecs, leading to a possible rounding up from tst_ts_to_us(). That rounding can lead to up to 500 nsecs of difference between the current time and the absolute time used for setting the timer. When reading the timer back, that same difference can be found, which leads to a test failure. By adding the usecs to timespec structure then setting the timer from the structure we avoid the rounding and end up with precise value instead. This can be easily reproducible by booting linux with clocksource=jiffies. Fixes: b34e243 (syscalls/timer_settime01: Make sure the timer fires) Reported-by: Kelsey Skunberg <kelsey.skunberg@canonical.com> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Signed-off-by: Cyril Hrubis <chrubis@suse.cz> Tested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
- Loading branch information