aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/bits/time.h8
-rw-r--r--sysdeps/unix/sysv/linux/clock.c7
2 files changed, 7 insertions, 8 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h
index 226d6dd64f..706946ce22 100644
--- a/sysdeps/unix/sysv/linux/bits/time.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -39,13 +39,13 @@ struct timeval
# ifndef _BITS_TIME_H
# define _BITS_TIME_H 1
-/* ISO/IEC 9899:1990 7.12.1: <time.h>
- The macro `CLOCKS_PER_SEC' is the number per second of the value
- returned by the `clock' function. */
+/* ISO/IEC 9899:1999 7.23.1: Components of time
+ The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
+ the number per second of the value returned by the `clock' function. */
/* CAE XSH, Issue 4, Version 2: <time.h>
The value of CLOCKS_PER_SEC is required to be 1 million on all
XSI-conformant systems. */
-# define CLOCKS_PER_SEC 1000000l
+# define CLOCKS_PER_SEC ((clock_t) 1000000)
# if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
&& !defined __USE_XOPEN2K
diff --git a/sysdeps/unix/sysv/linux/clock.c b/sysdeps/unix/sysv/linux/clock.c
index e06c4b328f..e568bf3543 100644
--- a/sysdeps/unix/sysv/linux/clock.c
+++ b/sysdeps/unix/sysv/linux/clock.c
@@ -20,15 +20,14 @@
#include <time.h>
#include <unistd.h>
-#if CLOCKS_PER_SEC != 1000000l
-# error "CLOCKS_PER_SEC should be 1000000"
-#endif
-
clock_t
clock (void)
{
struct timespec ts;
+ _Static_assert (CLOCKS_PER_SEC == 1000000,
+ "CLOCKS_PER_SEC should be 1000000");
+
/* clock_gettime shouldn't fail here since CLOCK_PROCESS_CPUTIME_ID is
supported since 2.6.12. Check the return value anyway in case the kernel
barfs on us for some reason. */