Returns the current elapsed time shown on this stopwatch, expressed in the desired time unit, with any fraction rounded down. <p><b>Note:</b> the overhead of measurement can be more than a microsecond, so it is generally not useful to specify {@link TimeUnit#NANOSECONDS} precision here. <p>It is g
(TimeUnit desiredUnit)
| 214 | * @since 14.0 (since 10.0 as {@code elapsedTime()}) |
| 215 | */ |
| 216 | public long elapsed(TimeUnit desiredUnit) { |
| 217 | return desiredUnit.convert(elapsedNanos(), NANOSECONDS); |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Returns the current elapsed time shown on this stopwatch as a {@link Duration}. Unlike {@link |