Interface Clock


public interface Clock
An abstraction for a clock.
Author:
Randall Hauch
  • Field Details

    • SYSTEM

      static final Clock SYSTEM
      The Clock instance that uses the System methods.
  • Method Details

    • system

      static Clock system()
      Get the Clock instance that uses the System methods.
      Returns:
      the system clock; never null
    • currentTime

      default Instant currentTime()
    • currentTimeInNanos

      default long currentTimeInNanos()
      Get the current time in nanoseconds.
      Returns:
      the current time in nanoseconds.
    • currentTimeInMicros

      default long currentTimeInMicros()
      Get the current time in microseconds.
      Returns:
      the current time in microseconds.
    • currentTimeAsInstant

      default Instant currentTimeAsInstant()
      Get the current time as an instant
      Returns:
      the current time as an instant.
    • currentTimeInMillis

      long currentTimeInMillis()
      Get the current time in milliseconds.
      Returns:
      the current time in milliseconds.