public class TimeSource
extends java.lang.Object
It can return times up to ns precision.
WARNING: This code can only run for up to 292 years without reset. Passed that delay it will return incoherent values due to System.nanoTime() overflowing.
| Constructor and Description |
|---|
TimeSource() |
| Modifier and Type | Method and Description |
|---|---|
static long |
currentTimeMillisToNanoTime(long timeMillis)
Return nanoTime from absolute time in millisecond.
|
static long |
getNanoTime()
Return the current time in nanoseconds
|
static long |
getTime()
Return the current time in the platform's native time units.
|
public static long getTime()
public static long getNanoTime()
public static long currentTimeMillisToNanoTime(long timeMillis)
timeMillis - time in millisecond from 1/1/1970.