Stops the stopwatch. Future reads will return the fixed duration that had elapsed up to this point. @return this Stopwatch instance @throws IllegalStateException if the stopwatch is already stopped.
()
| 162 | */ |
| 163 | |
| 164 | @CanIgnoreReturnValue |
| 165 | public Stopwatch stop() { |
| 166 | long tick = ticker.read(); |
| 167 | checkState(isRunning, "This stopwatch is already stopped."); |
| 168 | isRunning = false; |
| 169 | elapsedNanos += tick - startTick; |
| 170 | return this; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Sets the elapsed time for this stopwatch to zero, and places it in a stopped state. |
no test coverage detected