public enum TimeUnit extends Enum<TimeUnit>
Enum Constant and Description |
---|
DAY |
HOUR |
MILLISECOND |
MINUTE |
NANOSECOND |
SECOND |
YEAR |
Modifier and Type | Method and Description |
---|---|
long |
getMilliseconds()
Returns the divisor for the time unit to be converted to seconds.
|
static long |
toMilliseconds(TimeUnit aTimeUnit,
long aTime)
Converts a given time from the provided
TimeUnit to milliseconds. |
float |
toTime(TimeUnit aFromTimeUnit,
long aFromTime)
Converts a given time from one
TimeUnit to this instance's time
unit. |
static float |
toTimeUnit(TimeUnit aFromTimeUnit,
long aTime,
TimeUnit aToTimeUnit)
|
static TimeUnit |
valueOf(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 NANOSECOND
public static final TimeUnit MILLISECOND
public static final TimeUnit SECOND
public static final TimeUnit MINUTE
public static final TimeUnit HOUR
public static final TimeUnit DAY
public static final TimeUnit YEAR
public static TimeUnit[] values()
for (TimeUnit c : TimeUnit.values()) System.out.println(c);
public static TimeUnit valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic long getMilliseconds()
public float toTime(TimeUnit aFromTimeUnit, long aFromTime)
TimeUnit
to this instance's time
unit.aFromTimeUnit
- The TimeUnit
to convert from.aFromTime
- The time to be converted.Copyright © 2018. All rights reserved.