diff options
author | Tom Tromey <tromey@redhat.com> | 2006-03-29 15:22:30 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-03-29 15:22:30 +0000 |
commit | bd4ca424997fd4f8f7eaa32b933fc9e19eb38986 (patch) | |
tree | a7257bee49a99d35e1d893e95b10057d6362a7db /libjava/posix.cc | |
parent | c2a644391b7e8d4603d95e97daabd1b368052421 (diff) | |
download | gcc-bd4ca424997fd4f8f7eaa32b933fc9e19eb38986.zip gcc-bd4ca424997fd4f8f7eaa32b933fc9e19eb38986.tar.gz gcc-bd4ca424997fd4f8f7eaa32b933fc9e19eb38986.tar.bz2 |
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
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r-- | libjava/posix.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libjava/posix.cc b/libjava/posix.cc index 15fc9c5..e23eac2 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; |