Utility class with methods that deal with System#nanoTime().
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static long | Returns: the nanoseconds elapsedthe begin nanoTime beginNanoTime, long the end nanoTime endNanoTime)Calculates the nanoseconds elapsed between two nanoTimes. |
| public static boolean | Returns: whether the first nanoTime is strictly before the second nanoTimethe first nanoTime nanoTime1, long the second nanoTime nanoTime2)Returns whether the first nanoTime is strictly before the second nanoTime. |
| public static boolean | Returns: whether the first nanoTime is before or the same as the second nanoTimethe first nanoTime nanoTime1, long the second nanoTime nanoTime2)Returns whether the first nanoTime is before or the same as the second nanoTime. |
| public static long | Returns: the milliseconds elapsedthe begin nanoTime beginNanoTime, long the end nanoTime endNanoTime)Calculates the milliseconds elapsed between two nanoTimes. |
| public static long | Returns: the milliseconds elapsed between the given begin nanoTime and the current nanoTimethe begin nanoTime beginNanoTime)Calculates the milliseconds elapsed between a begin nanoTime and the current nanoTime. |
| public static long | Returns: the milliseconds remaining between the current nanoTime and the given end nanoTimethe end nanoTime endNanoTime)Calculates the milliseconds remaining between the current nanoTime and an end nanoTime. |
| public static long | |
| public static long | Returns: the seconds elapsedthe begin nanoTime beginNanoTime, long the end nanoTime endNanoTime)Calculates the seconds elapsed between two nanoTimes. |
| public static long | Returns: the seconds elapsed between the given begin nanoTime and the current nanoTimethe begin nanoTime beginNanoTime)Calculates the seconds elapsed between a begin nanoTime and the current nanoTime. |
| public static long | Returns: the seconds remaining between the current nanoTime and the given end nanoTimethe end nanoTime endNanoTime)Calculates the seconds remaining between the current nanoTime and an end nanoTime. |
| public static long | Returns: the nanoseconds elapsed since the given begin nanoTime and the current nanoTimethe begin nanoTime beginNanoTime)Calculates the nanoseconds elapsed since a begin nanoTime and the current nanoTime. |
| public static void | spinWait(long
the amount of nanoseconds to spin wait nanos)Spin waits for the specified number of nanoseconds. |
| public static long | Returns: the nanoseconds remaining from the current nanoTime until the given end nanoTimethe end nanoTime endNanoTime)Calculates the nanoseconds remaining from the current nanoTime until an end nanoTime. |
| NanoTime | back to summary |
|---|---|
| private NanoTime() | |
| elapsed | back to summary |
|---|---|
| public static long elapsed(long beginNanoTime, long endNanoTime) Calculates the nanoseconds elapsed between two nanoTimes.
| |
| isBefore | back to summary |
|---|---|
| public static boolean isBefore(long nanoTime1, long nanoTime2) Returns whether the first nanoTime is strictly before the second nanoTime. Reads as: Avoids the common mistake of comparing the 2 nanoTimes with the
less-than
| |
| isBeforeOrSame | back to summary |
|---|---|
| public static boolean isBeforeOrSame(long nanoTime1, long nanoTime2) Returns whether the first nanoTime is before or the same as the second nanoTime.
| |
| millisElapsed | back to summary |
|---|---|
| public static long millisElapsed(long beginNanoTime, long endNanoTime) Calculates the milliseconds elapsed between two nanoTimes.
| |
| millisSince | back to summary |
|---|---|
| public static long millisSince(long beginNanoTime) Calculates the milliseconds elapsed between a begin nanoTime and the current nanoTime.
| |
| millisUntil | back to summary |
|---|---|
| public static long millisUntil(long endNanoTime) Calculates the milliseconds remaining between the current nanoTime and an end nanoTime.
| |
| now | back to summary |
|---|---|
public static long now()
| |
| secondsElapsed | back to summary |
|---|---|
| public static long secondsElapsed(long beginNanoTime, long endNanoTime) Calculates the seconds elapsed between two nanoTimes.
| |
| secondsSince | back to summary |
|---|---|
| public static long secondsSince(long beginNanoTime) Calculates the seconds elapsed between a begin nanoTime and the current nanoTime.
| |
| secondsUntil | back to summary |
|---|---|
| public static long secondsUntil(long endNanoTime) Calculates the seconds remaining between the current nanoTime and an end nanoTime.
| |
| since | back to summary |
|---|---|
| public static long since(long beginNanoTime) Calculates the nanoseconds elapsed since a begin nanoTime and the current nanoTime.
| |
| spinWait | back to summary |
|---|---|
| public static void spinWait(long nanos) Spin waits for the specified number of nanoseconds.
| |
| until | back to summary |
|---|---|
| public static long until(long endNanoTime) Calculates the nanoseconds remaining from the current nanoTime until an end nanoTime.
| |