MCPcopy Create free account
hub / github.com/antlr/codebuff / toString

Method toString

corpus/java/training/guava/base/Stopwatch.java:190–199  ·  view source on GitHub ↗

Returns a string representation of the current elapsed time.

()

Source from the content-addressed store, hash-verified

188 * Returns a string representation of the current elapsed time.
189 */
190 @Override
191 public String toString() {
192 long nanos = elapsedNanos();
193
194 TimeUnit unit = chooseUnit(nanos);
195 double value = (double) nanos / NANOSECONDS.convert(1, unit);
196
197 // Too bad this functionality is not exposed as a regular method call
198 return Platform.formatCompact4Digits(value) + " " + abbreviate(unit);
199 }
200
201 private static TimeUnit chooseUnit(long nanos) {
202 if (DAYS.convert(nanos, NANOSECONDS) > 0) {

Callers

nothing calls this directly

Calls 5

elapsedNanosMethod · 0.95
chooseUnitMethod · 0.95
formatCompact4DigitsMethod · 0.95
abbreviateMethod · 0.95
convertMethod · 0.45

Tested by

no test coverage detected