@Beta public class FixedClock extends Object implements Clock
Beta
Explicitly allows you to set the time to any arbitrary value.
Constructor and 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 and 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()
Clock
System.currentTimeMillis()
.currentTimeMillis
in interface Clock
Copyright © 2011–2023 Google. All rights reserved.