ComputedInstant

public final class ComputedInstant


A locally computed Unix epoch time derived from an external time signal. Includes metadata that can be used to understand the probable accuracy, and the Ticks used to calculate it.

Summary

Public fields

final TimeSignal
final Ticks

Public methods

boolean
@Nullable Duration
@RequiresApi(api = VERSION_CODES.O)
getEstimatedError()

Returns an absolute value for accuracy estimate as a Duration, or null if the error cannot be computed.

@Nullable Long

Returns an absolute value for accuracy estimate in milliseconds, or null if the error cannot be computed.

Instant
@RequiresApi(api = VERSION_CODES.O)
getInstant()

Returns the computed Unix epoch time as an Instant.

long

Returns the computed Unix epoch time as a value in milliseconds.

TimeSignal

Returns the TimeSignal that was used to compute the instant.

Ticks

Returns the Ticks associated with this computed instant.

int
String

Public fields

originalTimeSignal

public final TimeSignal originalTimeSignal

ticks

public final Ticks ticks

Public methods

equals

public boolean equals(@Nullable Object o)

getEstimatedError

@RequiresApi(api = VERSION_CODES.O)
public @Nullable Duration getEstimatedError()

Returns an absolute value for accuracy estimate as a Duration, or null if the error cannot be computed.

When present, this value can be added and subtracted from an instant to arrive at probable bounds for the computed instant.

This value can be null if the behavior of the local device clock used to track ticks is not yet known, or has been detected to be unpredictable.

getEstimatedErrorMillis

public @Nullable Long getEstimatedErrorMillis()

Returns an absolute value for accuracy estimate in milliseconds, or null if the error cannot be computed.

When present, this value can be added and subtracted from an instant to arrive at probable bounds for the computed instant.

This value can be null if the behavior of the local device clock used to track ticks is not yet known, or has been detected to be unpredictable.

getInstant

@RequiresApi(api = VERSION_CODES.O)
public Instant getInstant()

Returns the computed Unix epoch time as an Instant.

getInstantMillis

public long getInstantMillis()

Returns the computed Unix epoch time as a value in milliseconds.

getOriginalTimeSignal

public TimeSignal getOriginalTimeSignal()

Returns the TimeSignal that was used to compute the instant.

getTicks

public Ticks getTicks()

Returns the Ticks associated with this computed instant.

hashCode

public int hashCode()

toString

public String toString()