programming-examples/java/Servlets_Session_Swing_Util/Timer.java
2019-11-15 12:59:38 +01:00

22 lines
560 B
Java

Timer
public final class Timer {
private long time = 0L;
static private Timer timer = null;
private Timer() {
time = -System.currentTimeMillis();
};
static public Timer getInstance() {
if(timer == null) timer = new Timer();
return timer;
};
public final String toString() {
time += System.currentTimeMillis();
return new StringBuffer(getClass().getName()).append(": [").append(time).append(" ms]").toString();
};
};;