| 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(java.lang.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(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 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(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 long transformNanos(long nanos)
nanos - public double transformMillis(double millis)
millis - public long transformMillis(long millis)
millis - public static final TimeUnit fromString(java.lang.String str)
str - Copyright © 2010-2020 anotheria.net. All Rights Reserved.