Package me.ahoo.cosid.store.tck
Class ManualClock
java.lang.Object
me.ahoo.cosid.store.tck.ManualClock
- All Implemented Interfaces:
me.ahoo.cosid.time.TimeSource
A clock that moves only when told to, in either direction: the store clock of an
InMemoryStore or the
client clock of a generator under test. Thread-safe.-
Field Summary
Fields inherited from interface me.ahoo.cosid.time.TimeSource
SYSTEM -
Constructor Summary
ConstructorsConstructorDescriptionA clock at the current system time.ManualClock(long startMillis) A clock atstartMillis. -
Method Summary
Modifier and TypeMethodDescriptionlongMoves the time byamount; a negative amount moves it back.longvoidset(long newMillis) Sets the time, forwards or backwards.
-
Constructor Details
-
ManualClock
public ManualClock(long startMillis) A clock atstartMillis.- Parameters:
startMillis- milliseconds since the Unix epoch
-
ManualClock
public ManualClock()A clock at the current system time.
-
-
Method Details
-
currentMillis
public long currentMillis()- Specified by:
currentMillisin interfaceme.ahoo.cosid.time.TimeSource
-
set
public void set(long newMillis) Sets the time, forwards or backwards.- Parameters:
newMillis- milliseconds since the Unix epoch
-
advance
Moves the time byamount; a negative amount moves it back.- Parameters:
amount- how far to move- Returns:
- the new time
-