Darwin doesn't support clock_gettime() but has _POSIX_MONOTONIC_CLOCK defined
so use a more strict check with _POSIX_TIMERS.
This fixes the following compilation error:
java_lang_VMSystem.c: In function ‘Java_java_lang_VMSystem_nanoTime’:
java_lang_VMSystem.c:148: warning: implicit declaration of function
‘clock_gettime’
java_lang_VMSystem.c:148: error: ‘CLOCK_MONOTONIC’ undeclared (first use in
this function)
java_lang_VMSystem.c:148: error: (Each undeclared identifier is reported only
once
java_lang_VMSystem.c:148: error: for each function it appears in.)
Signed-off-by: Pekka Enberg
---
native/jni/java-lang/java_lang_VMSystem.c |2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/native/jni/java-lang/java_lang_VMSystem.c
b/native/jni/java-lang/java_lang_VMSystem.c
index 047c2b3..5c4a65b 100644
--- a/native/jni/java-lang/java_lang_VMSystem.c
+++ b/native/jni/java-lang/java_lang_VMSystem.c
@@ -141,7 +141,7 @@ Java_java_lang_VMSystem_nanoTime
(JNIEnv * env,
jclass thisClass __attribute__ ((__unused__)))
{
-#ifdef _POSIX_MONOTONIC_CLOCK
+#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
jlong result;
struct timespec tp;
--
1.7.4.1