[LTP] [PATCH] syscalls/timer_settime01: adjust for rounding from nsec to usec

Cyril Hrubis chrubis@suse.cz
Tue Oct 20 14:23:51 CEST 2020


Hi!
> What about this change instead?
> 
> diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
> index 67143e8f8..599ef2891 100644
> --- a/testcases/kernel/syscalls/timer_settime/timer_settime01.c
> +++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
> @@ -132,11 +132,13 @@ static void run(unsigned int n)
>  					get_clock_str(clock));
>  				continue;
>  			}
> -			val += tst_ts_to_us(timenow);
> +			tst_ts_add_us(timenow, val);
> +			tst_its_set_value_from_ts(&new_set, timenow);
> +		} else {
> +			tst_its_set_value_from_us(&new_set, val);
>  		}
>  
>  		tst_its_set_interval_from_us(&new_set, tc->it_interval_tv_usec);
> -		tst_its_set_value_from_us(&new_set, val);
>  
>  		TEST(tv->timer_settime(timer, tc->flag, tst_its_get(&new_set), tst_its_get(tc->old_ptr)));
>  
> 
> 
> By adding the us to the timenow first and then setting the its.value
> from it we can avoid the rounding completely.

Does this fix work for you?

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list