Add MyTimer.java. This is a simple timer.

This commit is contained in:
XIXI 2023-03-27 23:38:47 +08:00
parent 36967b2438
commit b77cb369a3

View File

@ -0,0 +1,26 @@
public class MyTimer {
private long startTime = 0;
private long endTime = 0;
public MyTimer() {
this.start();
}
public void start() {
this.startTime = System.currentTimeMillis();
}
public void stop() {
this.endTime = System.currentTimeMillis();
}
public long getMillisecond() {
return this.endTime - this.startTime;
}
public long getSecond() {
return (this.endTime - this.startTime)/1000;
}
}