This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Define CLOCKS_PER_SEC type to the type clock_t
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, GNU C Library <libc-alpha at sourceware dot org>
- Date: Mon, 05 Jan 2015 14:32:53 -0800
- Subject: Re: [PATCH] Define CLOCKS_PER_SEC type to the type clock_t
- Authentication-results: sourceware.org; auth=none
- References: <20150105204653 dot GA31001 at intel dot com>
On 01/05/2015 12:46 PM, H.J. Lu wrote:
C99 specifies that CLOCKS_PER_SEC is a constant expression
A minor point (mostly for comments): CLOCKS_PER_SEC needn't be a
constant expression. Even POSIX doesn't require that: on the contrary,
it explicitly warns you that it might not be a constant expression, even
though it must evaluate to 1000000.
+ * bits/time2.h: New file.
+ * sysdeps/unix/sysv/linux/x86/bits/time2.h: Likewise.
Wouldn't it be simpler and clearer to replace "# define CLOCKS_PER_SEC
1000000l" with "# define CLOCKS_PER_SEC ((clock_t) 1000000)"? That way,
one wouldn't need all these other little files running around.