Class NanoClock

    • Method Detail

      • nanos

        public long nanos()
        This returns the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC). This method will return valid values till the year 2262.
        Returns:
        the nanosecond-based instant, measured from 1970-01-01T00:00Z (UTC)
      • system

        public static NanoClock system​(ZoneId zone)
        This clock is based on the nano system clock. It uses System.nanoTime() resolution

        Conversion from instant to date or time uses the specified time-zone.

        The returned implementation is immutable, thread-safe and Serializable.

        Parameters:
        zone - the time-zone to use to convert the instant to date-time
        Returns:
        a clock that uses the best available system clock in the specified zone
        Throws:
        NullPointerException - if the given zone is null
      • systemUTC

        public static NanoClock systemUTC()
        This clock is based on the nano system clock. It uses System.nanoTime() resolution

        Conversion from instant to date or time uses the specified time-zone.

        The returned implementation is immutable, thread-safe and Serializable.

        Returns:
        a clock that uses the best available system clock in the UTC zone
        Throws:
        NullPointerException - if the given zone is null
      • systemDefaultZone

        public static NanoClock systemDefaultZone()
        This clock is based on the nano system clock. It uses System.nanoTime() resolution

        Conversion from instant to date or time uses the specified time-zone.

        The returned implementation is immutable, thread-safe and Serializable.

        Returns:
        a clock that uses the best available system clock in the default zone
        Throws:
        NullPointerException - if the given zone is null