Rev 6914 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.erggroup.buildtool.utilities;import java.text.SimpleDateFormat;import java.util.Calendar;public class ElapseTime {/** Capture the current time when the class is instantiated**/long startTime;public ElapseTime(){reset();}public void reset(){startTime = System.nanoTime();}/*** Returns elapsed time as a string* @return*/public String toString(){return String.format("%.03f", toSecs());}/** Returns elapsed time as seconds and fractions of a second*/public double toSecs(){return ((System.nanoTime() - startTime)/1000000000.0);}public int toIntSecs(){return (int)(toSecs() + 0.5);}static public String getTimeStamp(){return new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(Calendar.getInstance().getTime());}}