public class SystemTimer extends Object implements Timer
Default implementation of the Timer
which based on the System.currentTimeMillis()
method.
Example:
public class ExampleMojo extends AbstractMojo { public void execute() {Timer
timer =SystemTimer.getStartedTimer()
; // logic ... getLog().info("Finished in " + timer.stop()); } }
Constructor and Description |
---|
SystemTimer()
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
static SystemTimer |
getStartedTimer()
Returns a new started timer.
|
Time |
getTime()
Returns a current counted time.
|
void |
start()
Starts counting time.
|
Time |
stop()
Stops counting time.
|
public void start()
Timer
public Time getTime()
null
when timer has not been startedcurrent time - start time
when timer has been started and has not been stoppedcounted time during stop
when timer has been stoppedpublic static SystemTimer getStartedTimer()
start()
Copyright © 2015–2016 gabrys.biz. All rights reserved.