summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native/java_lang_System.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-06-20 15:57:53 -0700
committerElliott Hughes <enh@google.com>2013-06-20 15:57:53 -0700
commit7757924895a28a43ab9f7c3931cc9f972e870ddc (patch)
treea98775de51a2e86f774efa1b1e4e18d60668c1c0 /luni/src/main/native/java_lang_System.cpp
parent42602143f054ccf7ab692c8fe229dadc8fcb58e7 (diff)
downloadlibcore-7757924895a28a43ab9f7c3931cc9f972e870ddc.zip
libcore-7757924895a28a43ab9f7c3931cc9f972e870ddc.tar.gz
libcore-7757924895a28a43ab9f7c3931cc9f972e870ddc.tar.bz2
Use CLOCK_MONOTONIC_RAW for System.nanoTime.
We still need to use CLOCK_MONOTONIC on Darwin. Bug: 9511688 Change-Id: Ieb1091e24ad5cd3bab79a4de1b1494cc64eef3d4
Diffstat (limited to 'luni/src/main/native/java_lang_System.cpp')
-rw-r--r--luni/src/main/native/java_lang_System.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/luni/src/main/native/java_lang_System.cpp b/luni/src/main/native/java_lang_System.cpp
index 0686310..2c48309 100644
--- a/luni/src/main/native/java_lang_System.cpp
+++ b/luni/src/main/native/java_lang_System.cpp
@@ -94,7 +94,11 @@ static jlong System_currentTimeMillis(JNIEnv*, jclass) {
static jlong System_nanoTime(JNIEnv*, jclass) {
timespec now;
- clock_gettime(CLOCK_MONOTONIC, &now);
+#ifdef CLOCK_MONOTONIC_RAW
+ clock_gettime(CLOCK_MONOTONIC_RAW, &now);
+#else // Darwin, say.
+ clock_gettime(CLOCK_MONOTONIC, &now);
+#endif
return now.tv_sec * 1000000000LL + now.tv_nsec;
}