28 lines
580 B
Plaintext
28 lines
580 B
Plaintext
|
package th.co.muangthai.endrprint.util;
|
||
|
|
||
|
/**
|
||
|
* Created by Matthaus on 9/29/15.
|
||
|
*/
|
||
|
public class Stopwatch {
|
||
|
|
||
|
private final long start;
|
||
|
|
||
|
/**
|
||
|
* Initializes a new stopwatch.
|
||
|
*/
|
||
|
public Stopwatch() {
|
||
|
start = System.currentTimeMillis();
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Returns the elapsed CPU time (in seconds) since the stopwatch was created.
|
||
|
*
|
||
|
* @return elapsed CPU time (in seconds) since the stopwatch was created
|
||
|
*/
|
||
|
public double elapsedTime() {
|
||
|
long now = System.currentTimeMillis();
|
||
|
return (now - start) / 1000.0;
|
||
|
}
|
||
|
|
||
|
}
|