@Test public void testGetValue() { double millis = 12346789.0d; Duration duration = new Duration(millis, MILLISECONDS); assertThat(duration.getValue(MILLISECONDS)).isEqualTo(millis); assertThat(duration.getValue(SECONDS)).isCloseTo(millis / 1000, offset(0.001)); assertThat(duration.getValue(MINUTES)).isCloseTo(millis / 1000 / 60, offset(0.001)); assertThat(duration.getValue(HOURS)).isCloseTo(millis / 1000 / 60 / 60, offset(0.001)); assertThat(duration.getValue(DAYS)).isCloseTo(millis / 1000 / 60 / 60 / 24, offset(0.001)); double days = 3.0; duration = new Duration(days, DAYS); assertThat(duration.getValue(DAYS)).isEqualTo(days); assertThat(duration.getValue(HOURS)).isCloseTo(days * 24, offset(0.001)); assertThat(duration.getValue(MINUTES)).isCloseTo(days * 24 * 60, offset(0.001)); assertThat(duration.getValue(SECONDS)).isCloseTo(days * 24 * 60 * 60, offset(0.001)); assertThat(duration.getValue(MILLISECONDS)).isCloseTo(days * 24 * 60 * 60 * 1000, offset(0.001)); }
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);  }