@UnstableApi
interface Clock

Known direct subclasses
FakeClock

Fake Clock implementation that allows to advance the time manually to trigger pending timed messages.

SystemClock

The standard implementation of Clock, an instance of which is available via DEFAULT.


An interface through which system clocks can be read and HandlerWrappers created. The DEFAULT implementation must be used for all non-test cases.

Summary

Constants

const Clock!

Default Clock to use for all non-test cases.

Public functions

HandlerWrapper!
createHandler(
    looper: Looper!,
    callback: @UnknownInitialization Handler.Callback?
)

Creates a HandlerWrapper using a specified looper and a specified callback for handling messages.

Long

Returns the current time in milliseconds since the Unix Epoch.

Long
Long

See nanoTime

Unit

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

Constants

DEFAULT

const val DEFAULTClock!

Default Clock to use for all non-test cases.

Public functions

createHandler

fun createHandler(
    looper: Looper!,
    callback: @UnknownInitialization Handler.Callback?
): HandlerWrapper!

Creates a HandlerWrapper using a specified looper and a specified callback for handling messages.

See also
Handler

currentTimeMillis

fun currentTimeMillis(): Long

Returns the current time in milliseconds since the Unix Epoch.

elapsedRealtime

fun elapsedRealtime(): Long
See also
elapsedRealtime

nanoTime

fun nanoTime(): Long

See nanoTime

onThreadBlocked

fun onThreadBlocked(): Unit

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.

uptimeMillis

fun uptimeMillis(): Long
See also
uptimeMillis