summaryrefslogtreecommitdiffstats
path: root/libjava/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-09 18:47:54 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-09 18:47:54 +0000
commitc44de8ab02bf815fb920a2e6f1e6e16aadf05b07 (patch)
tree744b26f2524a58c1a0d12f1c85353fc349623374 /libjava/java
parent595e90415cd831dfd3680ccdb134f5f71392a88e (diff)
downloadppe42-gcc-c44de8ab02bf815fb920a2e6f1e6e16aadf05b07.tar.gz
ppe42-gcc-c44de8ab02bf815fb920a2e6f1e6e16aadf05b07.zip
* win32.cc (_Jv_platform_nanotime): New function.
* include/win32.h (_Jv_platform_nanotime): Declare. * posix.cc (_Jv_platform_nanotime): New function. * include/posix.h (_Jv_platform_nanotime): Declare. * java/lang/natSystem.cc (nanoTime): New method. * java/lang/System.java (nanoTime): Declare. * include/config.h.in, configure: Rebuilt. * configure.ac: Check for clock_gettime. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111869 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/lang/System.java11
-rw-r--r--libjava/java/lang/natSystem.cc8
2 files changed, 17 insertions, 2 deletions
diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java
index 005cba1397c..8ba0e8960cb 100644
--- a/libjava/java/lang/System.java
+++ b/libjava/java/lang/System.java
@@ -1,5 +1,5 @@
/* System.java -- useful methods to interface with the system
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -208,6 +208,15 @@ public final class System
public static native long currentTimeMillis();
/**
+ * Get the current time, measured in nanoseconds. The result is as
+ * precise as possible, and is measured against a fixed epoch.
+ * However, unlike currentTimeMillis(), the epoch chosen is
+ * arbitrary and may vary by platform, etc.
+ * @since 1.5
+ */
+ public static native long nanoTime();
+
+ /**
* Copy one array onto another from <code>src[srcStart]</code> ...
* <code>src[srcStart+len-1]</code> to <code>dest[destStart]</code> ...
* <code>dest[destStart+len-1]</code>. First, the arguments are validated:
diff --git a/libjava/java/lang/natSystem.cc b/libjava/java/lang/natSystem.cc
index 0a4c8b9a0f7..42a13258daf 100644
--- a/libjava/java/lang/natSystem.cc
+++ b/libjava/java/lang/natSystem.cc
@@ -1,6 +1,6 @@
// natSystem.cc - Native code implementing System class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006 Free Software Foundation
This file is part of libgcj.
@@ -124,6 +124,12 @@ java::lang::System::currentTimeMillis (void)
return _Jv_platform_gettimeofday ();
}
+jlong
+java::lang::System::nanoTime ()
+{
+ return _Jv_platform_nanotime ();
+}
+
jint
java::lang::System::identityHashCode (jobject obj)
{
OpenPOWER on IntegriCloud