# TimeDifferenceComplicationText

Artifact: [androidx.wear.watchface:watchface-complications-data](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/data/Text.kt+class:androidx.wear.watchface.complications.data.TimeDifferenceComplicationText) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText "View this page in Java")


```
class TimeDifferenceComplicationText : ComplicationText
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText` that represents a time difference.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText` representing a time difference. |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/java/util/concurrent/TimeUnit.html?` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#getMinimumTimeUnit()()` Gets the smallest unit that may be shown in the time difference text. |
| `open https://developer.android.com/reference/java/time/Instant.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#getNextChangeTime(java.time.Instant)(afterInstant: https://developer.android.com/reference/java/time/Instant.html)` Returns the next time after `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant)` at which the text may change. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#getTextAt(android.content.res.Resources,java.time.Instant)(resources: https://developer.android.com/reference/android/content/res/Resources.html, instant: https://developer.android.com/reference/java/time/Instant.html)` Returns the text that should be displayed for the given timestamp. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#isAlwaysEmpty()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#returnsSameText(java.time.Instant,java.time.Instant)(firstInstant: https://developer.android.com/reference/java/time/Instant.html, secondInstant: https://developer.android.com/reference/java/time/Instant.html)` Returns true if the result of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant)` will be the same for both `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)` and `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)`. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/TimeDifferenceComplicationText#toString()()` |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### getMinimumTimeUnit

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

```
fun getMinimumTimeUnit(): TimeUnit?
```

Gets the smallest unit that may be shown in the time difference text. If specified, units smaller than this minimum will not be included.

### getNextChangeTime

```
open fun getNextChangeTime(afterInstant: Instant): Instant
```

Returns the next time after `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getNextChangeTime(java.time.Instant)` at which the text may change.

### getTextAt

```
open fun getTextAt(resources: Resources, instant: Instant): CharSequence
```

Returns the text that should be displayed for the given timestamp.

| Parameters |
|---|---|
| `resources: https://developer.android.com/reference/android/content/res/Resources.html` | `https://developer.android.com/reference/android/content/res/Resources.html` from the current context |
| `instant: https://developer.android.com/reference/java/time/Instant.html` | The `https://developer.android.com/reference/java/time/Instant.html` at which to sample the text |

### hashCode

```
open fun hashCode(): Int
```

### isAlwaysEmpty

```
open fun isAlwaysEmpty(): Boolean
```

### returnsSameText

```
open fun returnsSameText(firstInstant: Instant, secondInstant: Instant): Boolean
```

Returns true if the result of `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#getTextAt(android.content.res.Resources,java.time.Instant)` will be the same for both `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)` and `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/ComplicationText#returnsSameText(java.time.Instant,java.time.Instant)`.

### toString

```
open fun toString(): String
```