Class Clock

java.lang.Object
com.codahale.metrics.Clock
Direct Known Subclasses:
Clock.UserTimeClock

public abstract class Clock extends Object
An abstraction for how time passes. It is passed to Timer to track timing.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    A clock implementation which returns the current time in epoch nanoseconds.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Clock
    The default clock to use.
    abstract long
    Returns the current time tick.
    long
    Returns the current time in milliseconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Clock

      public Clock()
  • Method Details

    • getTick

      public abstract long getTick()
      Returns the current time tick.
      Returns:
      time tick in nanoseconds
    • getTime

      public long getTime()
      Returns the current time in milliseconds.
      Returns:
      time in milliseconds
    • defaultClock

      public static Clock defaultClock()
      The default clock to use.
      Returns:
      the default Clock instance
      See Also: