[PATCH] Define CLOCKS_PER_SEC type to the type clock_t

H.J. Lu hjl.tools@gmail.com
Tue Jan 6 01:06:00 GMT 2015


On Mon, Jan 5, 2015 at 3:43 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 01/05/2015 03:25 PM, H.J. Lu wrote:
>>
>> This is the updated patch.  OK to install?
>
>
> Looks good to me, and thanks.

Well, it doesn't work due to:

#if CLOCKS_PER_SEC != 1000000l
# error "CLOCKS_PER_SEC should be 1000000"
#endif

in sysdeps/unix/sysv/linux/clock.c.

Here is the updated patch.  I replaced the above # error with

 assert (CLOCKS_PER_SEC == 1000000l);

I compared the assembly outputs before and after.  There
are no differences on i686 and x86-64.  OK to install?

Thanks.

-- 
H.J.
----
[BZ #17797]
* bits/time.h (CLOCKS_PER_SEC): Changed to ((clock_t) 1000000).
* sysdeps/unix/sysv/linux/bits/time.h (CLOCKS_PER_SEC): Likewise.
* sysdeps/unix/sysv/linux/clock.c: Include <assert.h>.
(clock): Assert CLOCKS_PER_SEC == 1000000l.
* time/clocktest.c (main): Replace %ld with %jd and cast to
intmax_t.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Define-CLOCKS_PER_SEC-type-to-the-type-clock_t.patch
Type: text/x-patch
Size: 5262 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150106/5c66d8e2/attachment.bin>


More information about the Libc-alpha mailing list