Enum Constant and Description |
---|
DAY
A day = 24 * 60 * 60 * 1000 ms.
|
HOUR
An hour = 60 * 60 * 1000 ms.
|
MILLI_SECOND
A milli second.
|
MINUTE
A minute = 60 * 1000 ms.
|
SECOND
A second = 1000 ms.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getSIUnit()
Returns the SI name of the unit.
|
int |
getUnitToMs()
Returns the amount of milli seconds one "piece" of unit has.
|
boolean |
isIntegerInUnit(long timeInMs)
Returns true if the given time in ms is an integer value in the given unit.
|
long |
toMs(double timeInUnit)
Returns the time in ms a given quantity of time in this unit corresponds to.
|
java.lang.String |
toString() |
double |
toUnit(long timeInMs)
Returns the amount of time in the given unit.
|
static TimeUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static TimeUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TimeUnit MILLI_SECOND
public static final TimeUnit SECOND
public static final TimeUnit MINUTE
public static final TimeUnit HOUR
public static final TimeUnit DAY
public static TimeUnit[] values()
for (TimeUnit c : TimeUnit.values()) System.out.println(c);
public static TimeUnit valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic java.lang.String toString()
toString
in class java.lang.Enum<TimeUnit>
public java.lang.String getSIUnit()
public int getUnitToMs()
public double toUnit(long timeInMs)
timeInMs
- The time in ms for which the time in the given unit should be calculated.public long toMs(double timeInUnit)
timeInUnit
- Time in the given unit.public boolean isIntegerInUnit(long timeInMs)
timeInMs
- Time in ms.