aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/sys/NanoTimer.java
diff options
context:
space:
mode:
authorHolger Zickner <[email protected]>2005-07-01 14:11:01 +0000
committerHolger Zickner <[email protected]>2005-07-01 14:11:01 +0000
commit667a27ca1186506757adae0997089f018beac49a (patch)
treed6c78403003446f5c1cc9eb0d81769cd4261182a /src/jake2/sys/NanoTimer.java
parente4c1237ba261da7d3dcc00f474ab1428b9643317 (diff)
different Timers implementing Milliseconds()
Diffstat (limited to 'src/jake2/sys/NanoTimer.java')
-rw-r--r--src/jake2/sys/NanoTimer.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/jake2/sys/NanoTimer.java b/src/jake2/sys/NanoTimer.java
new file mode 100644
index 0000000..d654fe8
--- /dev/null
+++ b/src/jake2/sys/NanoTimer.java
@@ -0,0 +1,27 @@
+/*
+ * NanoTimer.java
+ * Copyright (C) 2005
+ *
+ * $Id: NanoTimer.java,v 1.1 2005-07-01 14:11:00 hzi Exp $
+ */
+package jake2.sys;
+
+
+public class NanoTimer extends Timer {
+
+ private long base;
+
+ NanoTimer() {
+ base = System.nanoTime();
+ }
+
+ public long currentTimeMillis() {
+ long time = System.nanoTime();
+ long delta = time - base;
+ if (delta < 0) {
+ delta += Long.MAX_VALUE + 1;
+ }
+ return (long)(delta * 0.000001);
+ }
+
+}