From c0f39fbe0c75e76dd8c98abfafd0db0e18ef199a Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 8 Apr 2011 20:32:33 -0600 Subject: [PATCH] implement System.nanoTime This is a quick and coarse, but servicable, implementation. --- classpath/java/lang/System.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/classpath/java/lang/System.java b/classpath/java/lang/System.java index 954c62d116..9506fb3457 100644 --- a/classpath/java/lang/System.java +++ b/classpath/java/lang/System.java @@ -20,6 +20,8 @@ import java.io.FileDescriptor; import java.util.Properties; public abstract class System { + private static final long NanoTimeBaseInMillis = currentTimeMillis(); + private static Property properties; private static SecurityManager securityManager; @@ -94,6 +96,10 @@ public abstract class System { public static native int identityHashCode(Object o); + public static long nanoTime() { + return (currentTimeMillis() - NanoTimeBaseInMillis) * 1000000; + } + public static String mapLibraryName(String name) { if (name != null) { return doMapLibraryName(name);