aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/sys/NanoTimer.java
blob: d654fe871ffb780bf5d4f81833777f8212f20ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
	}

}