summaryrefslogtreecommitdiff
path: root/libjava/posix.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-29 15:22:30 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-29 15:22:30 +0000
commitda13fdfe7a26705b6c36bd21c315d8facf78fc8e (patch)
treea7257bee49a99d35e1d893e95b10057d6362a7db /libjava/posix.cc
parent5f458503731f4a23c7c674adebf7c4185e26579c (diff)
downloadgcc-da13fdfe7a26705b6c36bd21c315d8facf78fc8e.tar.gz
* posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and
CLOCK_HIGHRES. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r--libjava/posix.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libjava/posix.cc b/libjava/posix.cc
index 15fc9c5c3f8..e23eac269cc 100644
--- a/libjava/posix.cc
+++ b/libjava/posix.cc
@@ -71,7 +71,15 @@ _Jv_platform_nanotime ()
{
#ifdef HAVE_CLOCK_GETTIME
struct timespec now;
- if (clock_gettime (CLOCK_REALTIME, &now) == 0)
+ int id;
+#ifdef CLOCK_MONOTONIC
+ id = CLOCK_MONOTONIC;
+#elif defined (CLOCK_HIGHRES)
+ id = CLOCK_HIGHRES;
+#else
+ id = CLOCK_REALTIME;
+#endif
+ if (clock_gettime (id, &now) == 0)
{
jlong result = (jlong) now.tv_sec;
result = result * 1000 * 1000 + now.tv_nsec;