[LTP] [RFC] [PATCH] lib/tst_test: Use CLOCK_MONOTONIC for -I option.

Li Wang liwang@redhat.com
Thu Jan 25 06:50:55 CET 2018


On Mon, Jan 22, 2018 at 10:19 PM, Cyril Hrubis <chrubis@suse.cz> wrote:

> ​...
>
> -       return tv.tv_sec * 1000 + tv.tv_usec / 1000;
> +       return tst_timespec_to_ms(ts);
>


​Both patches(include the old-lib one) looks good.

I just have a small question about function tst_timespec_to_ms(), why the
t.tv_nsec plus 500000 when convert to msec?

static inline long long tst_timespec_to_ms(struct timespec t)
{
    return t.tv_sec * 1000 + (t.tv_nsec + 500000) / 1000000;
}
​


-- 
Li Wang
liwang@redhat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180125/3bbef9d1/attachment.html>


More information about the ltp mailing list