public class NanoTimer extends Timer
NanoTimer
is a System.nanoTime implementation of Timer
.
This is primarily useful for headless applications running on a server.Constructor and Description |
---|
NanoTimer() |
Modifier and Type | Method and Description |
---|---|
float |
getFrameRate()
Returns the "calls per second".
|
long |
getResolution()
Returns the resolution of the timer.
|
long |
getTime()
Returns the current time in ticks.
|
float |
getTimeInSeconds()
Returns the time in seconds.
|
float |
getTimePerFrame()
Returns the time, in seconds, between the last call and the current one.
|
void |
reset()
Reset the timer to 0.
|
void |
update()
update recalculates the frame rate based on the previous
call to update. |
public float getTimeInSeconds()
getTimeInSeconds
in class Timer
public long getTime()
Timer
getResolution()
. The timer starts at 0 ticks.public long getResolution()
Timer
getResolution
in class Timer
public float getFrameRate()
Timer
getFrameRate
in class Timer
public float getTimePerFrame()
Timer
getTimePerFrame
in class Timer
public void update()
Timer
update
recalculates the frame rate based on the previous
call to update. It is assumed that update is called each frame.