Class Timer

java.lang.Object
com.ardor3d.util.Timer
All Implemented Interfaces:
ReadOnlyTimer

public class Timer extends Object implements ReadOnlyTimer
Timer is a ReadOnlyTimer implementation with nanosecond resolution.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the current number of frames per second (fps).
    long
    Get the resolution used by this timer.
    long
    Get elapsed time since this timer was created or reset, in the resolution specified by the implementation (usually in nanoseconds).
    double
    Get elapsed time in seconds since this timer was created or reset.
    double
    Get the time elapsed between the latest two frames, in seconds.
    void
    Reset this timer, so that getTime() and getTimeInSeconds() reflects the time spend from this call.
    void
    Update should be called once per frame to correctly update "time per frame" and "frame rate (fps)"

    Methods inherited from class java.lang.Object

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

    • Timer

      public Timer()
  • Method Details

    • getTimeInSeconds

      public double getTimeInSeconds()
      Description copied from interface: ReadOnlyTimer
      Get elapsed time in seconds since this timer was created or reset.
      Specified by:
      getTimeInSeconds in interface ReadOnlyTimer
      Returns:
      Time in seconds
      See Also:
    • getTime

      public long getTime()
      Description copied from interface: ReadOnlyTimer
      Get elapsed time since this timer was created or reset, in the resolution specified by the implementation (usually in nanoseconds).
      Specified by:
      getTime in interface ReadOnlyTimer
      Returns:
      Time in resolution specified by implementation
      See Also:
    • getResolution

      public long getResolution()
      Description copied from interface: ReadOnlyTimer
      Get the resolution used by this timer. Nanosecond resolution would return 10^9
      Specified by:
      getResolution in interface ReadOnlyTimer
      Returns:
      Timer resolution
    • getFrameRate

      public double getFrameRate()
      Description copied from interface: ReadOnlyTimer
      Get the current number of frames per second (fps).
      Specified by:
      getFrameRate in interface ReadOnlyTimer
      Returns:
      Current frames per second (fps)
    • getTimePerFrame

      public double getTimePerFrame()
      Description copied from interface: ReadOnlyTimer
      Get the time elapsed between the latest two frames, in seconds.
      Specified by:
      getTimePerFrame in interface ReadOnlyTimer
      Returns:
      Time between frames, in seconds
    • update

      public void update()
      Update should be called once per frame to correctly update "time per frame" and "frame rate (fps)"
    • reset

      public void reset()
      Reset this timer, so that getTime() and getTimeInSeconds() reflects the time spend from this call.