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

    Modifier and Type
    Method
    Description
    long
    Returns the current value of this clock's high-resolution time source, in milliseconds.
    long
    Returns the current value of this clock's high-resolution time source, in nanoseconds.
  • Method Details

    • 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.