ShadowLegacySystemClock, ShadowPausedSystemClock@Implements(value=android.os.SystemClock.class, shadowPicker=Picker.class, looseSignatures=true) public abstract class ShadowSystemClock extends Object
SystemClock.
The behavior of SystemClock in Robolectric will differ based on the current LooperMode. See ShadowLegacySystemClock and ShadowPausedSystemClock for more
details.| Modifier and Type | Class | Description |
|---|---|---|
static class |
ShadowSystemClock.Picker |
| Modifier and Type | Field | Description |
|---|---|---|
protected static boolean |
networkTimeAvailable |
| Constructor | Description |
|---|---|
ShadowSystemClock() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
advanceBy(Duration duration) |
A convenience method for advancing the clock via
SystemClock.setCurrentTimeMillis(long) |
protected static Object |
currentGnssTimeClock() |
|
static long |
currentTimeMillis() |
Implements
System.currentTimeMillis() through ShadowWrangler. |
static long |
nanoTime() |
Deprecated.
Don't call this method directly; instead, use
System.nanoTime(). |
static void |
reset() |
|
static void |
setGnssTimeAvailable(boolean available) |
Sets whether gnss location based time is available.
|
static void |
setNanoTime(long nanoTime) |
Sets the value for
System.nanoTime(). |
static void |
setNetworkTimeAvailable(boolean available) |
Sets whether network time is available.
|
public static long currentTimeMillis()
System.currentTimeMillis() through ShadowWrangler.@Deprecated public static long nanoTime()
System.nanoTime().System.nanoTime().public static void setNanoTime(long nanoTime)
System.nanoTime().
May only be used for LooperMode.Mode.LEGACY. For LooperMode.Mode.PAUSED,
{@param nanoTime} is calculated based on SystemClock.uptimeMillis() and can't be set
explicitly.
public static void setNetworkTimeAvailable(boolean available)
public static void advanceBy(Duration duration)
SystemClock.setCurrentTimeMillis(long)duration - The interval by which to advance.@Implementation(minSdk=29) protected static Object currentGnssTimeClock()
public static void setGnssTimeAvailable(boolean available)
public static void reset()