Package 

Class Clock


  • 
    public class Clock
    
                        

    A simple wrapper for system clock that aims to provide the current time

    The JDK provides two clocks:

    one in nanoseconds, for precision, but it can only use to measure durations one in milliseconds, for accuracy, useful to provide epoch time

    At this time, we are using a millis precision (converted to micros) in order to guarantee consistency between the span start times and the durations

    • Method Summary

      Modifier and Type Method Description
      static long currentNanoTicks() Get the current nanos ticks, this method can't be use for date accuracy (only durationcalculations)
      static long currentMicroTime() Get the current time in micros.
      static long currentNanoTime() Get the current time in nanos.
      • Methods inherited from class java.lang.Object

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

      • currentNanoTicks

         static long currentNanoTicks()

        Get the current nanos ticks, this method can't be use for date accuracy (only durationcalculations)

      • currentMicroTime

         static long currentMicroTime()

        Get the current time in micros. The actual precision is the millis

      • currentNanoTime

         static long currentNanoTime()

        Get the current time in nanos. The actual precision is the millis Note: this will overflow in~290 years after epoch