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
-
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the current number of frames per second (fps).long
Get the resolution used by this timer.long
getTime()
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()
Reset this timer, so thatgetTime()
andgetTimeInSeconds()
reflects the time spend from this call.void
update()
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:ReadOnlyTimer
Get elapsed time in seconds since this timer was created or reset.- Specified by:
getTimeInSeconds
in interfaceReadOnlyTimer
- 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 interfaceReadOnlyTimer
- 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 interfaceReadOnlyTimer
- 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 interfaceReadOnlyTimer
- 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 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.
-