The {@code system} factory methods provide clocks based on the best availablesystem clock This may use {@link System#currentTimeMillis()}, or a higher resolution clock if one is available. @implSpec This abstract class must be implemented with care to ensure other classes 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.
The returned instants from {@code Clock} work on a time-scale that ignores leap seconds,as described in {@link Instant}. If the implementation wraps a source that provides leap second information, then a mechanism should be used to "smooth" the leap second. The Java Time-Scale mandates the use of UTC-SLS, however clock implementations may choose how accurate they are with the time-scale so long as they document how they work. Implementations are therefore not required to actually perform the UTC-SLS slew or to otherwise be aware of leap seconds.
Implementations should implement {@code Serializable} wherever possible and mustdocument whether or not they do support serialization. @implNote The clock implementation provided here is based on {@link System#currentTimeMillis()}. That method provides little to no guarantee about the accuracy of the clock. Applications requiring a more accurate clock must implement this abstract class themselves using a different external clock, such as an NTP server. @since 1.8
|
|
|
|