[PATCH][BZ #12515] Improve precision of clock function
Ondřej Bílka
neleai@seznam.cz
Tue May 21 15:22:00 GMT 2013
On Tue, May 21, 2013 at 08:26:11PM +0530, Siddhesh Poyarekar wrote:
> Hi,
>
> The current implementation of clock() uses times(), which only has
> millisecond precision. Attached patch uses clock_gettime
> (CLOCK_PROCESS_CPUTIME_ID) if it is available so as to improve the
> precision to at least to the extent of CLOCKS_PER_SECOND, which comes
> to about a microsecond. No regressions on x86_64. I'll add a note in
> NEWS as well if this is acked. OK to commit?
>
No, you said CLOCK_PROCESS_CPUTIME_ID but you wrote
> + if (__clock_gettime (CLOCK_REALTIME, &ts) == 0)
More information about the Libc-alpha
mailing list