Package net.sodacan.core.util
Class FixedClock
java.lang.Object
java.time.Clock
net.sodacan.core.util.FixedClock
- All Implemented Interfaces:
InstantSource
-
Constructor Summary
ConstructorsConstructorDescriptionIf you just need a clock that doesn't move, without calling advanceClock, use this constructorFixedClock
(Instant fixedInstant) If you need a clock that is fixed based on an instant that you provide, use this one -
Method Summary
Methods inherited from class java.time.Clock
equals, fixed, hashCode, millis, offset, system, systemDefaultZone, systemUTC, tick, tickMillis, tickMinutes, tickSeconds
-
Constructor Details
-
FixedClock
public FixedClock()If you just need a clock that doesn't move, without calling advanceClock, use this constructor -
FixedClock
If you need a clock that is fixed based on an instant that you provide, use this one- Parameters:
fixedInstant
-
-
-
Method Details
-
advanceClock
public void advanceClock()Calling advanceClock advances it by one second. -
getZone
-
withZone
- Specified by:
withZone
in interfaceInstantSource
- Specified by:
withZone
in classClock
-
instant
- Specified by:
instant
in interfaceInstantSource
- Specified by:
instant
in classClock
-