Index: native/jni/java-lang/java_lang_VMSystem.c
===================================================================
RCS file: /sources/classpath/classpath/native/jni/java-lang/java_lang_VMSystem.c,v
retrieving revision 1.15
diff -u -u -r1.15 java_lang_VMSystem.c
--- native/jni/java-lang/java_lang_VMSystem.c	26 Jul 2006 20:18:04 -0000	1.15
+++ native/jni/java-lang/java_lang_VMSystem.c	4 Nov 2010 23:58:44 -0000
@@ -39,8 +39,12 @@
 
 #include <jcl.h>
 
+#include <time.h>
 #include <sys/time.h>
 #include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
 
 /*
  * Class:     java_lang_VMSystem
@@ -111,6 +115,22 @@
   (*env)->SetStaticObjectField (env, cls, field, obj);
 }
 
+static jlong currentTimeMillis(JNIEnv * env)
+{
+  /* Note: this implementation copied directly from Japhar's, by Chris Toshok. */
+  jlong result;
+  struct timeval tp;
+
+  if (gettimeofday (&tp, NULL) == -1)
+    (*env)->FatalError (env, "gettimeofday call failed.");
+
+  result = (jlong) tp.tv_sec;
+  result *= (jlong)1000000L;
+  result += (jlong)tp.tv_usec;
+
+  return result;
+}
+
 /*
  * Class:     java_lang_VMSystem
  * Method:    nanoTime
@@ -118,22 +138,40 @@
  */
 JNIEXPORT jlong JNICALL
 Java_java_lang_VMSystem_nanoTime
-  (JNIEnv * env __attribute__ ((__unused__)),
+  (JNIEnv * env,
    jclass thisClass __attribute__ ((__unused__)))
 {
-  /* Note: this implementation copied directly from Japhar's, by Chris Toshok. */
+#ifdef _POSIX_MONOTONIC_CLOCK
   jlong result;
-  struct timeval tp;
+  struct timespec tp;
 
-  if (gettimeofday (&tp, NULL) == -1)
-    (*env)->FatalError (env, "gettimeofday call failed.");
+  if (clock_gettime (CLOCK_MONOTONIC, &tp) == -1) {
+    char error[64];
+    snprintf(error, 64, "clock_gettime call failed: %s.", strerror(errno));
+    (*env)->FatalError (env, error);
+  }
 
   result = (jlong) tp.tv_sec;
-  result *= (jlong)1000000L;
-  result += (jlong)tp.tv_usec;
-  result *= (jlong)1000;
+  result *= (jlong)1000000000L;
+  result += (jlong)tp.tv_nsec;
 
   return result;
+#else
+  return currentTimeMillis(env) * (jlong)1000;
+#endif
+}
+
+/*
+ * Class:     java_lang_VMSystem
+ * Method:    currentTimeMillis
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL
+Java_java_lang_VMSystem_currentTimeMillis
+  (JNIEnv * env,
+   jclass thisClass __attribute__ ((__unused__)))
+{
+  return currentTimeMillis(env) / (jlong)1000L;
 }
 
 JNIEXPORT jstring JNICALL
Index: vm/reference/java/lang/VMSystem.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/java/lang/VMSystem.java,v
retrieving revision 1.19
diff -u -u -r1.19 VMSystem.java
--- vm/reference/java/lang/VMSystem.java	8 Jul 2010 22:20:58 -0000	1.19
+++ vm/reference/java/lang/VMSystem.java	4 Nov 2010 23:58:47 -0000
@@ -129,10 +129,7 @@
    * @return the current time
    * @see java.util.Date
    */
-   static long currentTimeMillis()
-   {
-     return nanoTime() / 1000000L;
-   }
+  static native long currentTimeMillis();
 
   /**
    * <p>
