# SystemClock

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/util/SystemClock.java+class:androidx.media3.common.util.SystemClock)

*** ** * ** ***


```
@UnstableApi
public class SystemClock implements Clock
```

<br />

*** ** * ** ***

The standard implementation of `https://developer.android.com/reference/androidx/media3/common/util/Clock`, an instance of which is available via `https://developer.android.com/reference/androidx/media3/common/util/Clock#DEFAULT()`.

## Summary

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#SystemClock()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/util/HandlerWrapper` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#createHandler(android.os.Looper,android.os.Handler.Callback)( https://developer.android.com/reference/android/os/Looper.html looper, @https://checkerframework.org/api/org/checkerframework/checker/initialization/qual/UnknownInitialization.html @https://developer.android.com/reference/androidx/annotation/Nullable @https://checkerframework.org/api/org/checkerframework/checker/initialization/qual/UnknownInitialization.html https://developer.android.com/reference/android/os/Handler.Callback.html callback )` Creates a `https://developer.android.com/reference/androidx/media3/common/util/HandlerWrapper` using a specified looper and a specified callback for handling messages. |
| `long` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#currentTimeMillis()()` Returns the current time in milliseconds since the Unix Epoch. |
| `long` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#elapsedRealtime()()` |
| `long` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#nanoTime()()` See `https://developer.android.com/reference/java/lang/System.html#nanoTime()` |
| `void` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#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` | `https://developer.android.com/reference/androidx/media3/common/util/SystemClock#uptimeMillis()()` |

| ### Inherited Constants |
|---|
| From [androidx.media3.common.util.Clock](https://developer.android.com/reference/androidx/media3/common/util/Clock) |---|---| | `static final https://developer.android.com/reference/androidx/media3/common/util/Clock` | `https://developer.android.com/reference/androidx/media3/common/util/Clock#DEFAULT()` Default `https://developer.android.com/reference/androidx/media3/common/util/Clock` to use for all non-test cases. | |

## Protected constructors

### SystemClock

```
protected SystemClock()
```

## Public methods

### createHandler

```
public HandlerWrapper createHandler(
    Looper looper,
    @UnknownInitialization @Nullable @UnknownInitialization Handler.Callback callback
)
```

Creates a `https://developer.android.com/reference/androidx/media3/common/util/HandlerWrapper` using a specified looper and a specified callback for handling messages.

| See also |
|---|---|
| `https://developer.android.com/reference/android/os/Handler.html#Handler(android.os.Looper, android.os.Handler.Callback)` |   |

### currentTimeMillis

```
public long currentTimeMillis()
```

Returns the current time in milliseconds since the Unix Epoch.

| See also |
|---|---|
| `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` |   |

### elapsedRealtime

```
public long elapsedRealtime()
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/os/SystemClock.html#elapsedRealtime()` |   |

### nanoTime

```
public long nanoTime()
```

See `https://developer.android.com/reference/java/lang/System.html#nanoTime()`

### onThreadBlocked

```
public 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.

### uptimeMillis

```
public long uptimeMillis()
```

| See also |
|---|---|
| `https://developer.android.com/reference/android/os/SystemClock.html#uptimeMillis()` |   |