public final class Duration extends Object implements Comparable<Duration>, Serializable
It is an (temporary) replacement for the the Measurable<Duration>
class in the remove JScience library. Will be removed (and be replaced by the
JDK version) when updated to Java 8.
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Duration other) |
boolean |
equals(Object obj) |
int |
hashCode() |
static Duration |
ofMillis(long millis)
Create a new duration object from the given milli seconds.
|
static Duration |
ofNanos(long nanos)
Create a new duration object from the given nano seconds.
|
static Duration |
ofSeconds(double seconds)
Create a new duration object from the given seconds.
|
long |
toMillis()
Return the amount of this duration in milli seconds.
|
long |
toNanos()
Return the amount of this duration in nano seconds.
|
double |
toSeconds()
Return the amount of this duration in seconds.
|
String |
toString() |
public long toNanos()
public long toMillis()
public double toSeconds()
public int compareTo(Duration other)
compareTo
in interface Comparable<Duration>
public static Duration ofNanos(long nanos)
nanos
- the amount of the new duration in nano seconds.public static Duration ofMillis(long millis)
millis
- the amount of the new duration in milli seconds.© 2007-2014 Franz Wilhelmstötter (2014-10-03 19:44)