Class MillisClock


  • @ThreadSafe
    public final class MillisClock
    extends Clock
    A Clock that uses System.currentTimeMillis() and System.nanoTime().
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MillisClock()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static MillisClock getInstance()
      Returns a MillisClock.
      Timestamp now()
      Obtains the current instant from this clock.
      long nowNanos()
      Returns a time measurement with nanosecond precision that can only be used to calculate elapsed time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • MillisClock

        private MillisClock()
    • Method Detail

      • getInstance

        public static MillisClock getInstance()
        Returns a MillisClock.
        Returns:
        a MillisClock.
      • 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.