diff options
Diffstat (limited to 'libjava/posix.cc')
-rw-r--r-- | libjava/posix.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libjava/posix.cc b/libjava/posix.cc index 3b55196..15fc9c5 100644 --- a/libjava/posix.cc +++ b/libjava/posix.cc @@ -1,6 +1,6 @@ // posix.cc -- Helper functions for POSIX-flavored OSs. -/* Copyright (C) 2000, 2001, 2002 Free Software Foundation +/* Copyright (C) 2000, 2001, 2002, 2006 Free Software Foundation This file is part of libgcj. @@ -66,6 +66,22 @@ _Jv_platform_gettimeofday () #endif } +jlong +_Jv_platform_nanotime () +{ +#ifdef HAVE_CLOCK_GETTIME + struct timespec now; + if (clock_gettime (CLOCK_REALTIME, &now) == 0) + { + jlong result = (jlong) now.tv_sec; + result = result * 1000 * 1000 + now.tv_nsec; + return result; + } + // clock_gettime failed, but we can fall through. +#endif // HAVE_CLOCK_GETTIME + return _Jv_platform_gettimeofday () * 1000LL; +} + // Platform-specific VM initialization. void _Jv_platform_initialize (void) |