Class ZeroTimeClock

java.lang.Object
io.opencensus.common.Clock
io.opencensus.internal.ZeroTimeClock

@Immutable public final class ZeroTimeClock extends Clock
A Clock that always returns 0.
  • Field Details

    • INSTANCE

      private static final ZeroTimeClock INSTANCE
    • ZERO_TIMESTAMP

      private static final Timestamp ZERO_TIMESTAMP
  • Constructor Details

    • ZeroTimeClock

      private ZeroTimeClock()
  • Method Details

    • getInstance

      public static ZeroTimeClock getInstance()
      Returns a ZeroTimeClock.
      Returns:
      a ZeroTimeClock.
    • now

      public Timestamp now()
      Description copied from class: Clock
      Obtains the current instant from this clock.
      Specified by:
      now in class Clock
      Returns:
      the current instant.
    • nowNanos

      public long nowNanos()
      Description copied from class: Clock
      Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.
      Specified by:
      nowNanos in class Clock
      Returns:
      a time measurement with nanosecond precision that can only be used to calculate elapsed time.