diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-11-05 00:09:46 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-11-05 00:09:46 +0000 |
commit | ce35f0abe5467d056c79abfe9bfb8acbc8f0c580 (patch) | |
tree | 40f0ae598fabd66e04c24f43017b90f8c30da5cd /vm | |
parent | 6605e28839909048684f485fa931cce6fa11535b (diff) | |
download | classpath-ce35f0abe5467d056c79abfe9bfb8acbc8f0c580.tar.gz |
PR44411: Make VMSystem.nanoTime independent of wall time where possible.
2010-11-04 Andrew John Hughes <ahughes@redhat.com>
Provide a fallback for systems without POSIX timers.
* native/jni/java-lang/java_lang_VMSystem.c:
(currentTimeMillis): New function which provides
the behaviour for both Java_java_lang_VMSystem_currentTimeMillis
and the fallback by obtaining the result of gettimeofday.
(Java_java_lang_VMSystem_nanoTime): Return currentTimeMillis
multiplied by a 1000 if a monotonic clock is unavailable.
(Java_java_lang_VMSystem_currentTimeMillis): Split main behaviour
out into currentTimeMillis and then return its result divided by a
1000.
2010-07-08 Roland Brand <roland.brand@ergon.ch>
Pekka Enberg <penberg@kernel.org>
PR classpath/44411
* native/jni/java-lang/java_lang_VMSystem.c:
(Java_java_lang_VMSystem_nanoTime): Implement
using POSIX monotonic clock support and clock_gettime.
(Java_java_lang_VMSystem_currentTimeMillis):
Use old nanoTime method (which uses gettimeofday) to
provide the current time in milliseconds.
* vm/reference/java/lang/VMSystem.java:
(currentTimeMillis()): Make native with its own implementation
rather than using nanoTime, which should be
independent of wall-clock time.
Diffstat (limited to 'vm')
-rw-r--r-- | vm/reference/java/lang/VMSystem.java | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/vm/reference/java/lang/VMSystem.java b/vm/reference/java/lang/VMSystem.java index a19466328..0b3d69200 100644 --- a/vm/reference/java/lang/VMSystem.java +++ b/vm/reference/java/lang/VMSystem.java @@ -129,10 +129,7 @@ final class VMSystem * @return the current time * @see java.util.Date */ - static long currentTimeMillis() - { - return nanoTime() / 1000000L; - } + static native long currentTimeMillis(); /** * <p> |