Class Clock

java.lang.Object
net.targetr.wtm3.Clock

public class Clock extends Object
Abstraction for the system clock.
Author:
Dr Michael Gardiner
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    Returns the current time in milliseconds since some arbitrary time in the past.
    static void
    sleep(int millis)
    Pauses the current thread for the specified number of 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

    • realtime

      public static long realtime()
      Returns the current time in milliseconds since some arbitrary time in the past. This method is useful for measuring elapsed time.
      Returns:
      A value in milliseconds for measuring time differences..
    • sleep

      public static void sleep(int millis)
      Pauses the current thread for the specified number of milliseconds.
      Parameters:
      millis - The number of milliseconds to sleep.
      Throws:
      RuntimeException - If the thread is interrupted while sleeping.