Package org.bitcoinj.base.internal
Class Stopwatch
java.lang.Object
org.bitcoinj.base.internal.Stopwatch
- All Implemented Interfaces:
TemporalAmount
A tool for measuring time, mainly for log messages. Note this class isn't affected by the mock clock of
TimeUtils.-
Method Summary
Modifier and TypeMethodDescriptionelapsed()Gets the elapsed time on the watch.longget(TemporalUnit temporalUnit) getUnits()booleanReturns true if the stopwatch is running.static Stopwatchstart()Start a newly created stopwatch.stop()Stops the stopwatch, if it is running.subtractFrom(Temporal temporal) toString()
-
Method Details
-
start
Start a newly created stopwatch.- Returns:
- the stopwatch that was just started
-
stop
Stops the stopwatch, if it is running.- Returns:
- the stopwatch that is stopped
-
isRunning
public boolean isRunning()Returns true if the stopwatch is running.- Returns:
- true if the stopwatch is running, false otherwise
-
elapsed
Gets the elapsed time on the watch. This doesn't stop the watch.- Returns:
- elapsed time
-
get
- Specified by:
getin interfaceTemporalAmount
-
getUnits
- Specified by:
getUnitsin interfaceTemporalAmount
-
addTo
- Specified by:
addToin interfaceTemporalAmount
-
subtractFrom
- Specified by:
subtractFromin interfaceTemporalAmount
-
toString
-