org.apache.hadoop.yarn.util

## Class MonotonicClock

- java.lang.Object
- - org.apache.hadoop.yarn.util.MonotonicClock

- All Implemented Interfaces:
    Clock

      @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class MonotonicClock
      extends Object
      implements Clock

  A monotonic clock from some arbitrary time base in the past, counting in milliseconds, and not affected by settimeofday or similar system clock changes. This is appropriate to use when computing how much longer to wait for an interval to expire. This function can return a negative value and it must be handled correctly by callers. See the documentation of System#nanoTime for caveats.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MonotonicClock()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getTime()` Get current time from some arbitrary time base in the past, counting in milliseconds, and not affected by settimeofday or similar system clock changes.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MonotonicClock

          public MonotonicClock()

  - ### Method Detail

    - #### getTime

          public long getTime()

      Get current time from some arbitrary time base in the past, counting in milliseconds, and not affected by settimeofday or similar system clock changes.
      Specified by:
        `getTime` in interface `Clock`
      Returns:
        a monotonic clock that counts in milliseconds.

Copyright © 2022 Apache Software Foundation. All rights reserved.