Class FixedClock
- java.lang.Object
-
- com.google.api.client.testing.http.FixedClock
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicLong
currentTime
-
Constructor Summary
Constructors Constructor Description FixedClock()
Initializes the FixedClock with 0 millis as start time.FixedClock(long startTime)
Initializes the FixedClock with the specified time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
currentTimeMillis()
Returns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the behavior ofSystem.currentTimeMillis()
.FixedClock
setTime(long newTime)
Changes the time value this time provider is returning.
-
-
-
Method Detail
-
setTime
public FixedClock setTime(long newTime)
Changes the time value this time provider is returning.- Parameters:
newTime
- New time in milliseconds.
-
currentTimeMillis
public long currentTimeMillis()
Description copied from interface:Clock
Returns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the behavior ofSystem.currentTimeMillis()
.- Specified by:
currentTimeMillis
in interfaceClock
-
-