From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] [PATCH] lib/tst_test: Use CLOCK_MONOTONIC for -I option.
Date: Thu, 25 Jan 2018 14:59:00 +0800 [thread overview]
Message-ID: <5A698034.6060909@cn.fujitsu.com> (raw)
In-Reply-To: <CAEemH2fR0Q3as6YJBkQK3VZ0_sdc0Rubqk0of+n0NTf8PtocwA@mail.gmail.com>
On 2018/01/25 13:50, Li Wang wrote:
>
>
> On Mon, Jan 22, 2018 at 10:19 PM, Cyril Hrubis <chrubis@suse.cz
> <mailto: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?
Hi Li,
It seems to round up/down the decimal produced by converting nesc to msec.
If the decimal is greater than 0.5, round up it. If not, round down it.
Thanks,
Xiao Yang
>
> 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 <mailto:liwang@redhat.com>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180125/f9723f6c/attachment.html>
next prev parent reply other threads:[~2018-01-25 6:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 14:19 [LTP] [RFC] [PATCH] lib/tst_test: Use CLOCK_MONOTONIC for -I option Cyril Hrubis
2018-01-23 8:31 ` Jan Stancek
2018-01-23 8:47 ` Cyril Hrubis
2018-02-07 15:15 ` Cyril Hrubis
2018-01-25 5:50 ` Li Wang
2018-01-25 6:59 ` Xiao Yang [this message]
2018-01-25 7:51 ` Li Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5A698034.6060909@cn.fujitsu.com \
--to=yangx.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.