Google is committed to advancing racial equity for Black communities. See how.

Uptime

@Immutable data class Uptime : Comparable<Uptime>
kotlin.Any
   ↳ androidx.ui.unit.Uptime

A single point in time with a time base of the system's uptime nanoseconds. Compare to Duration.

Arithmetic involving Uptime is limited and always involves Duration. For example, it is nonsensical to add two Uptimes, an Uptime + a Duration yields an Uptime, and an Uptime - an Uptime yields a Duration.

Summary

Public constructors
<init>(nanoseconds: Long)

A single point in time with a time base of the system's uptime nanoseconds.

Public methods
Int
compareTo(other: Uptime)

Compares this Uptime to other, returning zero if the values are equal.

operator Uptime
minus(duration: Duration)

Subtracts a Duration from this Uptime and returns the result.

operator Duration
minus(other: Uptime)

Returns the Duration between this Uptime and another.

operator Uptime
plus(duration: Duration)

Adds a Duration to this Uptime and returns the result.

Properties
Long

Companion properties
Uptime

The time at which the device booted (0 nanoseconds).

Public constructors

<init>

Uptime(nanoseconds: Long)

A single point in time with a time base of the system's uptime nanoseconds. Compare to Duration.

Arithmetic involving Uptime is limited and always involves Duration. For example, it is nonsensical to add two Uptimes, an Uptime + a Duration yields an Uptime, and an Uptime - an Uptime yields a Duration.

Public methods

compareTo

fun compareTo(other: Uptime): Int

Compares this Uptime to other, returning zero if the values are equal.

Returns a negative integer if this Uptime is shorter than other, or a positive integer if it is longer.

minus

operator fun minus(duration: Duration): Uptime

Subtracts a Duration from this Uptime and returns the result.

minus

operator fun minus(other: Uptime): Duration

Returns the Duration between this Uptime and another.

plus

operator fun plus(duration: Duration): Uptime

Adds a Duration to this Uptime and returns the result.

Properties

nanoseconds

val nanoseconds: Long

Companion properties

Boot

val Boot: Uptime

The time at which the device booted (0 nanoseconds).