Package engine.util

Class Timer

java.lang.Object
engine.util.Timer

public class Timer extends Object
Simple class that can be used to track how long something takes
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static boolean
    Tracks if milliseconds or nanoseconds are being used
    private static long
    Keeps track of initial time
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    end()
    Ends the timer and returns now long its been
    static void
    Starts the timer in milliseconds
    static void
    start(boolean millis)
    Starts the timer in either milliseconds or nanoseconds

    Methods inherited from class java.lang.Object

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

    • time

      private static long time
      Keeps track of initial time
    • millis

      private static boolean millis
      Tracks if milliseconds or nanoseconds are being used
  • Constructor Details

    • Timer

      public Timer()
  • Method Details

    • start

      public static void start(boolean millis)
      Starts the timer in either milliseconds or nanoseconds
      Parameters:
      millis - boolean representing if timer is milliseconds or not
    • start

      public static void start()
      Starts the timer in milliseconds
    • end

      public static long end()
      Ends the timer and returns now long its been
      Returns:
      total time elapsed, otherwise -1 if end() is called before start()