com.eg.agent.android.util.TicToc Maven / Gradle / Ivy
package com.eg.agent.android.util;
public class TicToc {
private long startTime;
private long endTime;
private State state;
private static 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)
{
this.state = State.STOPPED;
return this.endTime - this.startTime;
}
return -1L;
}
public long peek()
{
return System.currentTimeMillis() - this.startTime;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy