aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/sys/Timer.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/Timer.java
parente4c1237ba261da7d3dcc00f474ab1428b9643317 (diff)
different Timers implementing Milliseconds()
Diffstat (limited to 'src/jake2/sys/Timer.java')
-rw-r--r--src/jake2/sys/Timer.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/jake2/sys/Timer.java b/src/jake2/sys/Timer.java
new file mode 100644
index 0000000..4eede1f
--- /dev/null
+++ b/src/jake2/sys/Timer.java
@@ -0,0 +1,35 @@
+/*
+ * Timer.java
+ * Copyright (C) 2005
+ *
+ * $Id: Timer.java,v 1.1 2005-07-01 14:11:01 hzi Exp $
+ */
+package jake2.sys;
+
+import jake2.Globals;
+
+
+public abstract class Timer {
+
+ abstract public long currentTimeMillis();
+ private static long time = 0;
+
+ static Timer t;
+
+ static {
+ try {
+ t = new NanoTimer();
+ } catch (Throwable e) {
+ try {
+ t = new HighPrecisionTimer();
+ } catch (Throwable e1) {
+ t = new StandardTimer();
+ }
+ }
+ System.out.println("using " + t.getClass().getName());
+ }
+
+ public static int Milliseconds() {
+ return Globals.curtime = (int)(t.currentTimeMillis());
+ }
+}