Clock@Beta public class FixedClock extends Object implements Clock
Beta Explicitly allows you to set the time to any arbitrary value.
| Constructor | Description |
|---|---|
FixedClock() |
Initializes the FixedClock with 0 millis as start time.
|
FixedClock(long startTime) |
Initializes the FixedClock with the specified time.
|
| Modifier and Type | Method | Description |
|---|---|---|
long |
currentTimeMillis() |
Returns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the
behavior of
System.currentTimeMillis(). |
FixedClock |
setTime(long newTime) |
Changes the time value this time provider is returning.
|
public FixedClock()
public FixedClock(long startTime)
startTime - time in milliseconds used for initialization.public FixedClock setTime(long newTime)
newTime - New time in milliseconds.public long currentTimeMillis()
ClockSystem.currentTimeMillis().currentTimeMillis in interface ClockCopyright © 2011–2019 Google. All rights reserved.