jodd.datetime
Class SimpleTimer

java.lang.Object
  extended byjodd.datetime.SimpleTimer

public class SimpleTimer
extends java.lang.Object

Measures time periods.


Constructor Summary
SimpleTimer()
          Initialization and timer begins to count.
 
Method Summary
 long elapsed()
          Stops timer if running.
 long lap()
          Returns elapsed time from the last start and keeps timer running.
 void start()
          Starts the timer.
 long stop()
          Stops timer and returns elapsed time from last timer start in ms.
 java.lang.String toString()
          Returns elapsed time as String from the last start.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTimer

public SimpleTimer()
Initialization and timer begins to count.

Method Detail

start

public void start()
Starts the timer. If timer was already running, it resets.


stop

public long stop()
Stops timer and returns elapsed time from last timer start in ms.

Returns:
elapsed time in ms

lap

public long lap()
Returns elapsed time from the last start and keeps timer running.

Returns:
elapsed time in ms

elapsed

public long elapsed()
Stops timer if running. Returns elapsed time from the last timer start. If timer is not running, returns last measured time.

Returns:
elapsed time in ms

toString

public java.lang.String toString()
Returns elapsed time as String from the last start.

Returns:
elapsed time in ms


Jodd v0.24.5 Javadoc