This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ #12515] Improve precision of clock function
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 21 May 2013 17:18:39 +0200
- Subject: Re: [PATCH][BZ #12515] Improve precision of clock function
- References: <20130521145611 dot GM8927 at spoyarek dot pnq dot redhat dot com>
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)