Interface Clock


  • @ThreadSafe
    public interface Clock
    Interface for getting the current time.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long nanoTime()
      Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.
      long now()
      Obtains the current epoch timestamp in nanos from this clock.
    • Method Detail

      • now

        long now()
        Obtains the current epoch timestamp in nanos from this clock.
        Returns:
        the current epoch timestamp in nanos.
      • nanoTime

        long nanoTime()
        Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.
        Returns:
        a time measurement with nanosecond precision that can only be used to calculate elapsed time.