public final class AdjustableClock extends AbstractClock
Allows miscellaneous adjustments to any clock.
| Modifier and Type | Method and Description |
|---|---|
Moment |
currentTime()
Yields the current time.
|
boolean |
equals(Object obj) |
int |
hashCode() |
static AdjustableClock |
of(TimeSource<?> source)
Creates a new adjustable clock for given time source.
|
static AdjustableClock |
ofSystem()
Yields an adjustable clock around the standard system clock.
|
String |
toString()
For debugging purposes.
|
AdjustableClock |
withOffset(int offset,
TimeUnit unit)
Creates an adjusted clock which displays the current time with
given time shift.
|
AdjustableClock |
withPulse(TimeUnit pulse)
Creates a pulsed clock which only displays the current time in
given pulse unit.
|
inLocalView, inPlatformView, inZonalView, inZonalViewcurrentInstantpublic static AdjustableClock ofSystem()
Yields an adjustable clock around the standard system clock.
The clock can be adjusted using the with()-methods.
SystemClock.INSTANCEpublic static AdjustableClock of(TimeSource<?> source)
Creates a new adjustable clock for given time source.
After construction, the clock can be adjusted using the
with()-methods.
source - time source which shall be adjustedpublic AdjustableClock withPulse(TimeUnit pulse)
Creates a pulsed clock which only displays the current time in given pulse unit.
pulse - new pulsepublic AdjustableClock withOffset(int offset, TimeUnit unit)
Creates an adjusted clock which displays the current time with given time shift.
offset - amount of shiftunit - unit of shiftpublic Moment currentTime()
TimeSourceYields the current time.
UnixTime object or derivate)Copyright © 2014–2021. All rights reserved.