Interface Clock
-
- All Known Implementing Classes:
FakeClock
,SystemClock
public interface Clock
An interface through which system clocks can be read andHandlerWrapper
s created. TheDEFAULT
implementation must be used for all non-test cases.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HandlerWrapper
createHandler(Looper looper, Handler.Callback callback)
Creates aHandlerWrapper
using a specified looper and a specified callback for handling messages.long
currentTimeMillis()
Returns the current time in milliseconds since the Unix Epoch.long
elapsedRealtime()
void
onThreadBlocked()
Notifies the clock that the current thread is about to be blocked and won't return until a condition on another thread becomes true.long
uptimeMillis()
-
-
-
Method Detail
-
currentTimeMillis
long currentTimeMillis()
Returns the current time in milliseconds since the Unix Epoch.- See Also:
System.currentTimeMillis()
-
elapsedRealtime
long elapsedRealtime()
- See Also:
SystemClock.elapsedRealtime()
-
uptimeMillis
long uptimeMillis()
- See Also:
SystemClock.uptimeMillis()
-
createHandler
HandlerWrapper createHandler(Looper looper, @Nullable Handler.Callback callback)
Creates aHandlerWrapper
using a specified looper and a specified callback for handling messages.- See Also:
Handler(Looper, Handler.Callback)
-
onThreadBlocked
void onThreadBlocked()
Notifies the clock that the current thread is about to be blocked and won't return until a condition on another thread becomes true.Should be a no-op for all non-test cases.
-
-