@Test public void testNanoConversions() { double nanos = 1.0d; Duration duration = new Duration(nanos, NANOSECONDS); assertThat(duration.getValue()).isEqualTo(nanos); assertThat(duration.getValue(NANOSECONDS)).isEqualTo(nanos); assertThat(duration.getValue(MILLISECONDS)).isEqualTo(nanos / 1000000); assertThat(duration.getValue(SECONDS)).isEqualTo(nanos / 1000000 / 1000); assertThat(duration.getValue(MINUTES)).isCloseTo(nanos / 1000000 / 1000 / 60, offset(1.0E10)); assertThat(duration.getValue(HOURS)).isCloseTo(nanos / 1000000 / 1000 / 60 / 60, offset(1.0E10)); assertThat(duration.getValue(DAYS)).isCloseTo(nanos / 1000000 / 1000 / 60 / 60 / 24, offset(1.0E10)); }
public double getValue() { return value; }
Duration implements Comparable<Duration> { public double getValue() { return value; } }
Duration implements Comparable<Duration> { public double getValue() { return value; } Duration(double value, TimeUnit unit); }
Duration implements Comparable<Duration> { public double getValue() { return value; } Duration(double value, TimeUnit unit); static Duration nanosSince(long start); static Duration succinctNanos(long nanos); static Duration succinctDuration(double value, TimeUnit unit); long toMillis(); double getValue(); TimeUnit getUnit(); double getValue(TimeUnit timeUnit); long roundTo(TimeUnit timeUnit); Duration convertToMostSuccinctTimeUnit(); @JsonValue @Override String toString(); String toString(TimeUnit timeUnit); @JsonCreator static Duration valueOf(String duration); @Override int compareTo(Duration o); @Override boolean equals(Object o); @Override int hashCode(); static TimeUnit valueOfTimeUnit(String timeUnitString); static String timeUnitToString(TimeUnit timeUnit); }
Duration implements Comparable<Duration> { public double getValue() { return value; } Duration(double value, TimeUnit unit); static Duration nanosSince(long start); static Duration succinctNanos(long nanos); static Duration succinctDuration(double value, TimeUnit unit); long toMillis(); double getValue(); TimeUnit getUnit(); double getValue(TimeUnit timeUnit); long roundTo(TimeUnit timeUnit); Duration convertToMostSuccinctTimeUnit(); @JsonValue @Override String toString(); String toString(TimeUnit timeUnit); @JsonCreator static Duration valueOf(String duration); @Override int compareTo(Duration o); @Override boolean equals(Object o); @Override int hashCode(); static TimeUnit valueOfTimeUnit(String timeUnitString); static String timeUnitToString(TimeUnit timeUnit);  }