OSDN Git Service

* posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Mar 2006 15:22:30 +0000 (15:22 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 29 Mar 2006 15:22:30 +0000 (15:22 +0000)
CLOCK_HIGHRES.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112494 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/posix.cc

index 3540ccf..fe5de16 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-29  Tom Tromey  <tromey@redhat.com>
+
+       * posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and
+       CLOCK_HIGHRES.
+
 2006-03-28  Anthony Balkissoon  <abalkiss@redhat.com>
 
        * scripts/unicode-muncher.pl: Removed this file.
index 15fc9c5..e23eac2 100644 (file)
@@ -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;