Package javax.time

Class TimeSource.OffsetSystemTimeSource

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    TimeSource

    static final class TimeSource.OffsetSystemTimeSource
    extends TimeSource
    implements java.io.Serializable
    Implementation of a time-source that returns the latest time from System.currentTimeMillis() plus an offset.
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        A serialization identifier for this class.
        See Also:
        Constant Field Values
      • offset

        private final Duration offset
        The fixed offset to add.
    • Constructor Detail

      • OffsetSystemTimeSource

        private OffsetSystemTimeSource​(Duration offset)
        Restricted constructor.
    • Method Detail

      • instant

        public Instant instant()
        Gets the current Instant.

        The instant returned by this method will vary according to the implementation. For example, the time-source returned by TimeSource.system() will return an instant based on System.currentTimeMillis().

        Normally, this method will not throw an exception. 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.

        Specified by:
        instant in class TimeSource
        Returns:
        the current Instant from this time-source, never null
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object