public class FixedPreciseClock extends Object implements PreciseClock
PreciseClock
interface that always returns a fixed time value.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.
|
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)
PreciseClock
init
in interface PreciseClock
instant
- the container to be initialized with the accurate time informationpublic long currentTimeMillis()
Clock
currentTimeMillis
in interface Clock
Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.