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.long
get
(TemporalUnit temporalUnit) getUnits()
boolean
Returns true if the stopwatch is running.static Stopwatch
start()
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:
get
in interfaceTemporalAmount
-
getUnits
- Specified by:
getUnits
in interfaceTemporalAmount
-
addTo
- Specified by:
addTo
in interfaceTemporalAmount
-
subtractFrom
- Specified by:
subtractFrom
in interfaceTemporalAmount
-
toString
-