public class FixedPreciseClock extends java.lang.Object implements PreciseClock
PreciseClock interface that always returns a fixed time value.| Modifier and Type | Field and Description |
|---|---|
private long |
currentTimeMillis |
private int |
nanosOfMillisecond |
| Constructor and Description |
|---|
FixedPreciseClock()
Constructs a
FixedPreciseClock that always returns the epoch. |
FixedPreciseClock(long currentTimeMillis)
Constructs a
FixedPreciseClock that always returns the specified time in milliseconds since the epoch. |
FixedPreciseClock(long currentTimeMillis,
int nanosOfMillisecond)
Constructs a
FixedPreciseClock that always returns the specified time in milliseconds since the epoch
and nanosecond of the millisecond. |
| Modifier and Type | Method and Description |
|---|---|
long |
currentTimeMillis()
Returns the time in milliseconds since the epoch.
|
void |
init(MutableInstant instant)
Initializes the specified instant with time information as accurate as available on this platform.
|
private final long currentTimeMillis
private final int nanosOfMillisecond
public FixedPreciseClock()
FixedPreciseClock that always returns the epoch.public FixedPreciseClock(long currentTimeMillis)
FixedPreciseClock that always returns the specified time in milliseconds since the epoch.currentTimeMillis - milliseconds since the epochpublic FixedPreciseClock(long currentTimeMillis,
int nanosOfMillisecond)
FixedPreciseClock that always returns the specified time in milliseconds since the epoch
and nanosecond of the millisecond.currentTimeMillis - milliseconds since the epochnanosOfMillisecond - nanosecond of the specified millisecondpublic void init(MutableInstant instant)
PreciseClockinit in interface PreciseClockinstant - the container to be initialized with the accurate time informationpublic long currentTimeMillis()
ClockcurrentTimeMillis in interface Clock