public final class Time extends Object implements Comparable<Time>, Serializable
Modifier and Type | Field and Description |
---|---|
static Time |
ZERO
A time object that represents a zero time period, ie with no duration.
|
Modifier and Type | Method and Description |
---|---|
static Time |
add(Time a,
Time b)
Adds two time values.
|
long |
asMicroseconds()
Returns the time value in microseconds.
|
long |
asMilliseconds()
Returns the time value in milliseconds.
|
float |
asSeconds()
Returns the time value in seconds.
|
int |
compareTo(Time t) |
static Time |
div(Time a,
float s)
Scales a time by dividing it by a scalar.
|
boolean |
equals(Object o) |
static Time |
getMicroseconds(long microseconds)
Creates a new time with the given value.
|
static Time |
getMilliseconds(long milliseconds)
Creates a new time with the given value.
|
static Time |
getSeconds(float seconds)
Creates a new time with the given value.
|
int |
hashCode() |
static Time |
mul(Time a,
float s)
Scales a time by multiplying its value by a scalar.
|
static float |
ratio(Time a,
Time b)
Computes a time period's ratio of another time period.
|
static Time |
sub(Time a,
Time b)
Subtracts two time values.
|
String |
toString() |
public static final Time ZERO
public static Time getSeconds(float seconds)
seconds
- the time value, in seconds.public static Time getMilliseconds(long milliseconds)
milliseconds
- the time value in milliseconds.public static Time getMicroseconds(long microseconds)
microseconds
- the time value in microseconds.public static Time add(Time a, Time b)
a
- the first operand.b
- The second operand.public static Time sub(Time a, Time b)
a
- the minuend.b
- the subtrahend.public static Time mul(Time a, float s)
a
- the time to scale.s
- the scalar.public static Time div(Time a, float s)
a
- the time to scale.s
- the scalar.public static float ratio(Time a, Time b)
a
- The first time period.b
- The second time period.public float asSeconds()
public long asMilliseconds()
public long asMicroseconds()
public int compareTo(Time t)
compareTo
in interface Comparable<Time>