Class FixedClock
java.lang.Object
com.google.api.client.testing.http.FixedClock
- All Implemented Interfaces:
Clock
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes the FixedClock with 0 millis as start time.FixedClock(long startTime) Initializes the FixedClock with the specified time. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the behavior ofSystem.currentTimeMillis().setTime(long newTime) Changes the time value this time provider is returning.
-
Field Details
-
currentTime
-
-
Constructor Details
-
FixedClock
public FixedClock()Initializes the FixedClock with 0 millis as start time. -
FixedClock
public FixedClock(long startTime) Initializes the FixedClock with the specified time.- Parameters:
startTime- time in milliseconds used for initialization.
-
-
Method Details
-
setTime
Changes the time value this time provider is returning.- Parameters:
newTime- New time in milliseconds.
-
currentTimeMillis
public long currentTimeMillis()Description copied from interface:ClockReturns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the behavior ofSystem.currentTimeMillis().- Specified by:
currentTimeMillisin interfaceClock
-