Package trclib.timer
Class TrcStopwatch
java.lang.Object
trclib.timer.TrcStopwatch
This class implements a stopwatch.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
startTime
private double startTime -
lastElapsedTime
private double lastElapsedTime
-
-
Constructor Details
-
TrcStopwatch
public TrcStopwatch()
-
-
Method Details
-
start
public void start()This method starts the stopwatch. -
stop
public void stop()This method stops the stopwatch. -
isRunning
public boolean isRunning()This method checks if the stopwatch is running.- Returns:
- true if the stopwatch is running, false otherwise.
-
getElapsedTime
public double getElapsedTime()This method returns the elapsed time since the start time. If the stopwatch is not running, it returns the last elapsed time.- Returns:
- elapsed time since start, -1 if the stopwatch wasn't started.
-