@Implements(value=android.os.SystemClock.class) public class ShadowSystemClock extends java.lang.Object
Robolectric’s concept of current time is base on the current time of the UI Scheduler for consistency with previous implementations. This is not ideal, since both schedulers (background and foreground), can see different values for the current time.
Constructor and Description |
---|
ShadowSystemClock() |
Modifier and Type | Method and Description |
---|---|
protected static long |
currentNetworkTimeMillis() |
static long |
currentThreadTimeMicro() |
protected static long |
currentThreadTimeMillis() |
static long |
currentTimeMicro() |
static long |
currentTimeMillis()
Implements
System.currentTimeMillis() through ShadowWrangler. |
protected static long |
elapsedRealtime() |
protected static long |
elapsedRealtimeNanos() |
static long |
nanoTime()
Implements
System.nanoTime() through ShadowWrangler. |
static void |
reset() |
protected static boolean |
setCurrentTimeMillis(long millis) |
static void |
setNanoTime(long nanoTime) |
static void |
setNetworkTimeAvailable(boolean available)
Sets whether network time is available.
|
protected static void |
sleep(long millis) |
protected static long |
uptimeMillis() |
@Implementation protected static void sleep(long millis)
@Implementation protected static boolean setCurrentTimeMillis(long millis)
@Implementation protected static long uptimeMillis()
@Implementation protected static long elapsedRealtime()
@Implementation(minSdk=17) protected static long elapsedRealtimeNanos()
@Implementation protected static long currentThreadTimeMillis()
@HiddenApi @Implementation public static long currentThreadTimeMicro()
@HiddenApi @Implementation public static long currentTimeMicro()
public static long currentTimeMillis()
Implements System.currentTimeMillis()
through ShadowWrangler.
public static long nanoTime()
Implements System.nanoTime()
through ShadowWrangler.
public static void setNanoTime(long nanoTime)
@Implementation(minSdk=28) @HiddenApi protected static long currentNetworkTimeMillis()
public static void setNetworkTimeAvailable(boolean available)
Sets whether network time is available.
@Resetter public static void reset()