Package com.jme3.system
Class NanoTimer
java.lang.Object
com.jme3.system.Timer
com.jme3.system.NanoTimer
NanoTimer is a System.nanoTime implementation of Timer.
This is primarily useful for headless applications running on a server.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the "calls per second".longReturns the resolution of the timer.longgetTime()Returns the current time in ticks.floatReturns the time in seconds.floatReturns the time, in seconds, between the last call and the current one.voidreset()Reset the timer to 0.voidupdate()updaterecalculates the frame rate based on the previous call to update.
-
Constructor Details
-
NanoTimer
public NanoTimer()
-
-
Method Details
-
getTimeInSeconds
public float getTimeInSeconds()Returns the time in seconds. The timer starts at 0.0 seconds.- Overrides:
getTimeInSecondsin classTimer- Returns:
- the current time in seconds
-
getTime
public long getTime()Description copied from class:TimerReturns the current time in ticks. A tick is an arbitrary measure of time defined by the timer implementation. The number of ticks per second is given bygetResolution(). The timer starts at 0 ticks. -
getResolution
public long getResolution()Description copied from class:TimerReturns the resolution of the timer.- Specified by:
getResolutionin classTimer- Returns:
- the number of timer ticks per second
-
getFrameRate
public float getFrameRate()Description copied from class:TimerReturns the "calls per second". If this is called every frame, then it will return the "frames per second".- Specified by:
getFrameRatein classTimer- Returns:
- The "calls per second".
-
getTimePerFrame
public float getTimePerFrame()Description copied from class:TimerReturns the time, in seconds, between the last call and the current one.- Specified by:
getTimePerFramein classTimer- Returns:
- Time between this call and the last one.
-
update
public void update()Description copied from class:Timerupdaterecalculates the frame rate based on the previous call to update. It is assumed that update is called each frame. -
reset
public void reset()Description copied from class:TimerReset the timer to 0. Clear any tpf history.
-