diff options
Diffstat (limited to 'src/jake2/sys/NanoTimer.java')
-rw-r--r-- | src/jake2/sys/NanoTimer.java | 27 |
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); + } + +} |