From: Tom Tromey Date: Wed, 29 Mar 2006 15:22:30 +0000 (+0000) Subject: posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and CLOCK_HIGHRES. X-Git-Tag: releases/gcc-4.2.0~3516 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd4ca424997fd4f8f7eaa32b933fc9e19eb38986;p=thirdparty%2Fgcc.git posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and CLOCK_HIGHRES. * posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and CLOCK_HIGHRES. From-SVN: r112494 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3540ccf057b6..fe5de1686436 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2006-03-29 Tom Tromey + + * posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and + CLOCK_HIGHRES. + 2006-03-28 Anthony Balkissoon * scripts/unicode-muncher.pl: Removed this file. diff --git a/libjava/posix.cc b/libjava/posix.cc index 15fc9c5c3f85..e23eac269cc3 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;