Interface ApiClock

  • All Known Implementing Classes:
    CurrentMillisClock, NanoClock

    public interface ApiClock
    An interface for getting the current value of a high-resolution time source, in nanoseconds.

    Clocks other than NanoClock are typically used only for testing.

    This interface is required in addition to Java 8's Clock, because nanoTime is required to compare values with io.grpc.CallOptions.getDeadlineNanoTime().

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long millisTime()
      Returns the current value of this clock's high-resolution time source, in milliseconds.
      long nanoTime()
      Returns the current value of this clock's high-resolution time source, in nanoseconds.
    • Method Detail

      • nanoTime

        long nanoTime()
        Returns the current value of this clock's high-resolution time source, in nanoseconds.
      • millisTime

        long millisTime()
        Returns the current value of this clock's high-resolution time source, in milliseconds.