All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eg.agent.android.util.TicToc Maven / Gradle / Ivy

There is a newer version: 2.1.3
Show newest version
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