Top Description Methods
org.threeten.extra.scale

public Interface TimeSource

Imports
java.time.Clock, .Instant

A clock that provides the current UTC or TAI instant.

This clock differs from Clock in providing access to the current instant in the UTC and TAI time-scales. However, there is currently no implementation that provides accurate UTC or TAI.

Implementation Requirements:

This abstract class must be implemented with care to ensure other classes in the framework operate correctly. All implementations that can be instantiated must be final, immutable and thread-safe.

The principal methods are defined to allow the throwing of an exception. In normal use, no exceptions will be thrown, however one possible implementation would be to obtain the time from a central time server across the network. Obviously, in this case the lookup could fail, and so the method is permitted to throw an exception.

Subclass implementations should implement Serializable wherever possible. They should also be immutable and thread-safe, implementing equals(), hashCode() and toString() based on their state.

Method Summary

Modifier and TypeMethod and Description
public Instant

Returns:

the current Instant from this time-source, not null
instant
()

Gets the current Instant.

public TaiInstant

Returns:

the current TaiInstant from this time-source, not null
taiInstant
()

Gets the current TaiInstant.

public UtcInstant

Returns:

the current UtcInstant from this time-source, not null
utcInstant
()

Gets the current UtcInstant.

Method Detail

instantback to summary
public Instant instant()

Gets the current Instant.

The instant returned is based on the Java time-scale defined in Instant. An accurate implementation of this interface will return the correct instant as per that definition.

Returns:Instant

the current Instant from this time-source, not null

Exceptions
RuntimeException:
if the instant cannot be obtained, not thrown by most implementations
taiInstantback to summary
public TaiInstant taiInstant()

Gets the current TaiInstant.

The TAI time-scale is a simple incrementing number of seconds from the TAI epoch of 1958-01-01(TAI). It ignores all human concepts of time such as days. An accurate implementation of this interface will return the correct TAI instant.

Returns:TaiInstant

the current TaiInstant from this time-source, not null

Exceptions
RuntimeException:
if the instant cannot be obtained, not thrown by most implementations
utcInstantback to summary
public UtcInstant utcInstant()

Gets the current UtcInstant.

The UTC time-scale is the current world civil time and includes leap seconds. An accurate implementation of this interface will return the correct UTC instant.

Returns:UtcInstant

the current UtcInstant from this time-source, not null

Exceptions
RuntimeException:
if the instant cannot be obtained, not thrown by most implementations