Package com.ardor3d.util
Class Timer
java.lang.Object
com.ardor3d.util.Timer
- All Implemented Interfaces:
ReadOnlyTimer
Timer is a ReadOnlyTimer implementation with nanosecond resolution.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleGet the current number of frames per second (fps).longGet the resolution used by this timer.longgetTime()Get elapsed time since this timer was created or reset, in the resolution specified by the implementation (usually in nanoseconds).doubleGet elapsed time in seconds since this timer was created or reset.doubleGet the time elapsed between the latest two frames, in seconds.voidreset()Reset this timer, so thatgetTime()andgetTimeInSeconds()reflects the time spend from this call.voidupdate()Update should be called once per frame to correctly update "time per frame" and "frame rate (fps)"
-
Constructor Details
-
Timer
public Timer()
-
-
Method Details
-
getTimeInSeconds
public double getTimeInSeconds()Description copied from interface:ReadOnlyTimerGet elapsed time in seconds since this timer was created or reset.- Specified by:
getTimeInSecondsin interfaceReadOnlyTimer- Returns:
- Time in seconds
- See Also:
-
getTime
public long getTime()Description copied from interface:ReadOnlyTimerGet elapsed time since this timer was created or reset, in the resolution specified by the implementation (usually in nanoseconds).- Specified by:
getTimein interfaceReadOnlyTimer- Returns:
- Time in resolution specified by implementation
- See Also:
-
getResolution
public long getResolution()Description copied from interface:ReadOnlyTimerGet the resolution used by this timer. Nanosecond resolution would return 10^9- Specified by:
getResolutionin interfaceReadOnlyTimer- Returns:
- Timer resolution
-
getFrameRate
public double getFrameRate()Description copied from interface:ReadOnlyTimerGet the current number of frames per second (fps).- Specified by:
getFrameRatein interfaceReadOnlyTimer- Returns:
- Current frames per second (fps)
-
getTimePerFrame
public double getTimePerFrame()Description copied from interface:ReadOnlyTimerGet the time elapsed between the latest two frames, in seconds.- Specified by:
getTimePerFramein interfaceReadOnlyTimer- 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 thatgetTime()andgetTimeInSeconds()reflects the time spend from this call.
-