Class SystemTimer
- java.lang.Object
-
- biz.gabrys.maven.plugin.util.timer.SystemTimer
-
- All Implemented Interfaces:
Timer
public class SystemTimer extends Object implements Timer
Default implementation of the
Timerwhich based on theSystem.currentTimeMillis()method.Example:
public class ExampleMojo extends AbstractMojo { public void execute() {Timertimer =SystemTimer.getStartedTimer(); // logic ... getLog().info("Finished in " + timer.stop()); } }- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description SystemTimer()Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SystemTimergetStartedTimer()Returns a new started timer.TimeSpangetTime()Returns a current counted execution time.voidstart()Starts counting execution time.TimeSpanstop()Stops counting execution time.
-
-
-
Method Detail
-
start
public void start()
Description copied from interface:TimerStarts counting execution time.
-
getTime
public TimeSpan getTime()
Returns a current counted execution time. The current counted time span is equal to:nullwhen timer has not been startedcurrent time - start timewhen timer has been started and has not been stoppedcounted time during stopwhen timer has been stopped
-
getStartedTimer
public static SystemTimer getStartedTimer()
Returns a new started timer.- Returns:
- the new timer.
- Since:
- 1.0
- See Also:
start()
-
-