]> git.proxmox.com Git - wasi-libc.git/commitdiff
Define CLOCKS_PER_SEC to have type clock_t.
authorDan Gohman <sunfish@mozilla.com>
Mon, 29 Apr 2019 17:14:12 +0000 (10:14 -0700)
committerDan Gohman <sunfish@mozilla.com>
Wed, 1 May 2019 19:52:28 +0000 (12:52 -0700)
The C standard requires CLOCKS_PER_SEC to have type clock_t.

expected/wasm32-wasi/predefined-macros.txt
libc-bottom-half/headers/public/__header_time.h

index ad3c3494bdf2ff461f4ef9f2e2b368bc99eb248f..dfdeedb2630ff0bb7c375808c8f011012373d2f0 100644 (file)
 #define CLD_TRAPPED 4
 #define CLNEXT CTRL('v')
 #define CLOCAL 0004000
-#define CLOCKS_PER_SEC (1000000000)
+#define CLOCKS_PER_SEC ((clock_t)1000000000)
 #define CLOCK_MONOTONIC (&_CLOCK_MONOTONIC)
 #define CLOCK_PROCESS_CPUTIME_ID (&_CLOCK_PROCESS_CPUTIME_ID)
 #define CLOCK_REALTIME (&_CLOCK_REALTIME)
index de465952d292349765ea53759c574b7dd3910f66..efe42e7d036dbaa7a7b6db637c907da75b5d48b5 100644 (file)
@@ -25,7 +25,10 @@ extern const struct __clockid _CLOCK_THREAD_CPUTIME_ID;
 
 #define TIME_UTC __WASI_CLOCK_REALTIME
 
-/* FIXME: POSIX requires this to be 1000000, and that's what glibc and musl use. */
-#define CLOCKS_PER_SEC (1000000000)
+/*
+ * Note that XSI specifies CLOCKS_PER_SEC to be 1000000, rather than
+ * 1000000000; the clock API is providing more precision than XSI specifies.
+ */
+#define CLOCKS_PER_SEC ((clock_t)1000000000)
 
 #endif