public enum TimeUnit extends Enum<TimeUnit>
| Enum Constant and Description |
|---|
MICROSECONDS
Microseconds.
|
MILLISECONDS
Milliseconds, 1 ms = 1000 micros.
|
NANOSECONDS
Nanoseconds, native measurement unit.
|
SECONDS
Seconds.
|
| Modifier and Type | Method and Description |
|---|---|
static TimeUnit |
fromString(String str)
Helper method to create a TimeUnit from potentially incorrect textual representation (nanos, nanoseconds, seconds, millis, etc work).
|
double |
transformMillis(double millis)
Transforms (double) milliseconds to internal format.
|
long |
transformMillis(long millis)
Transforms (long) milliseconds to internal format.
|
long |
transformNanos(long nanos)
Transforms nanos to internal format (/factor).
|
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 NANOSECONDS
public static final TimeUnit MICROSECONDS
public static final TimeUnit MILLISECONDS
public static final TimeUnit SECONDS
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 transformNanos(long nanos)
nanos - public double transformMillis(double millis)
millis - public long transformMillis(long millis)
millis - Copyright © 2010-2017 anotheria.net. All Rights Reserved.