com.eg.agent.android.stats.TicToc Maven / Gradle / Ivy
package com.eg.agent.android.stats;
public class TicToc {
private long endTime;
private long startTime;
private State state;
private enum State {
STOPPED,
STARTED
}
public void tic() {
this.state = State.STARTED;
this.startTime = System.currentTimeMillis();
}
public long toc() {
this.endTime = System.currentTimeMillis();
if (this.state != State.STARTED) {
return -1;
}
this.state = State.STOPPED;
return this.endTime - this.startTime;
}
public long peek() {
return System.currentTimeMillis() - this.startTime;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy