java.lang.Object
com.pervasive.datarush.commons.util.Timer
Duration timer for elapsed wall-clock time. A
Timer provides
stop-watch like behavior useful for timing the duration between events.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Timer
public Timer()Create a new timer. The timer reads no time elapsed and is inactive.
-
-
Method Details
-
start
public void start()Starts the timer. The timer is considered active and measures the time elapsed since callingstart(). -
getStartTime
public long getStartTime()Gets the time at which the timer was last started.- Returns:
- the start time, as milliseconds since epoch
-
getDuration
public long getDuration()Gets the accumulated time elapsed, in milliseconds. If the timer is active, this is the time elapsed since callingstart(). If it is inactive, this is the amount of time which passed between thestart()andstop()calls.- Returns:
- the total elapsed time, in milliseconds
-
getEndTime
public long getEndTime()Gets the time at which the timer was stopped.- Returns:
- the end time, as milliseconds since epoch. If the timer is still
active then
Long.MIN_VALUE.
-
stop
public void stop()Stops the timer. If active, the timer becomes inactive and ceases to accumulate elapsed time. Until restarted, the reported duration is the interval of time between the call tostop()and the previous call tostart(). -
toString
-