de.unkrig.commons.util.time
Class Duration
java.lang.Object
de.unkrig.commons.util.time.Duration
public final class Duration
- extends java.lang.Object
Representation of the length of time between two points of time, with a resolution of 1 millisecond.
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Duration
public Duration(long ms)
Duration
public Duration(double seconds)
Duration
public Duration(java.lang.String s)
milliseconds
public long milliseconds()
- Returns:
- The number of milliseconds represented by this object
toSeconds
public double toSeconds()
- Returns:
- The length of time in seconds represented by this object
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
add
public Duration add(Duration other)
- Returns:
- A duration that represents the sum of
this and other
multiply
public Duration multiply(double factor)
- Returns:
- A duration that is
factor as long as this duration
divide
public Duration divide(double divisor)
- Returns:
- A duration which is one
divisorth of this duration long
isZero
public boolean isZero()
- Returns:
- Whether this object represents the zero-length interval
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
equals
public boolean equals(@Nullable
java.lang.Object obj)
- Overrides:
equals in class java.lang.Object