Class TimerUtil


  • public class TimerUtil
    extends java.lang.Object
    Access of the system clock so called wall time.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimerUtil()  
      TimerUtil​(long cPtr, boolean cMemoryOwn)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static double currentTime()
      Returns system clock in seconds

      Warning: The date/time at which this timer counts from is platform-specific, so
      you should not use it for getting the calendar time.
      static long currentTimeMs()
      Returns system clock in milli-seconds

      Warning: The date/time at which this timer counts from is platform-specific, so
      you should not use it for getting the calendar time.
      static long currentTimeUs()
      Returns system clock in micro-seconds.

      Warning: The date/time at which this timer counts from is platform-specific, so
      you should not use it for getting the calendar time.
      void delete()  
      static long getCPtr​(TimerUtil obj)  
      static void sleepMs​(int period)
      Sleeps for a period of time

      static void sleepUs​(int period)
      Sleeps for a period of time

      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TimerUtil

        public TimerUtil​(long cPtr,
                         boolean cMemoryOwn)
      • TimerUtil

        public TimerUtil()
    • Method Detail

      • getCPtr

        public static long getCPtr​(TimerUtil obj)
      • delete

        public void delete()
      • currentTimeMs

        public static long currentTimeMs()
        Returns system clock in milli-seconds

        Warning: The date/time at which this timer counts from is platform-specific, so
        you should not use it for getting the calendar time. It's really only meant for
        calculating wall time differences.
      • currentTimeUs

        public static long currentTimeUs()
        Returns system clock in micro-seconds.

        Warning: The date/time at which this timer counts from is platform-specific, so
        you should not use it for getting the calendar time. It's really only meant for
        calculating wall time differences.

        Notice: The timer cannot hold times longer than approx. 2100second.
      • currentTime

        public static double currentTime()
        Returns system clock in seconds

        Warning: The date/time at which this timer counts from is platform-specific, so
        you should not use it for getting the calendar time. It's really only meant for
        calculating wall time differences.
      • sleepMs

        public static void sleepMs​(int period)
        Sleeps for a period of time

        Parameters:
        period - [in] the time in miliseconds to sleep
      • sleepUs

        public static void sleepUs​(int period)
        Sleeps for a period of time

        Parameters:
        period - [in] the time in microseconds to sleep