com.jme.util
Class NanoTimer

java.lang.Object
  extended by com.jme.util.Timer
      extended by com.jme.util.NanoTimer

public class NanoTimer
extends Timer

NanoTimer is a System.nanoTime implementation of Timer. This is primarily useful for headless applications running on a server.

Author:
Matthew D. Hicks

Field Summary
 
Fields inherited from class com.jme.util.Timer
instance
 
Constructor Summary
NanoTimer()
           
 
Method Summary
 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.
 
Methods inherited from class com.jme.util.Timer
getTimer, setTimer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NanoTimer

public NanoTimer()
Method Detail

getTimeInSeconds

public float getTimeInSeconds()
Returns the time in seconds. The timer starts at 0.0 seconds.

Overrides:
getTimeInSeconds in class Timer
Returns:
the current time in seconds

getTime

public long getTime()
Description copied from class: Timer
Returns 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 by getResolution(). The timer starts at 0 ticks.

Specified by:
getTime in class Timer
Returns:
a long value representing the current time

getResolution

public long getResolution()
Description copied from class: Timer
Returns the resolution of the timer.

Specified by:
getResolution in class Timer
Returns:
the number of timer ticks per second

getFrameRate

public float getFrameRate()
Description copied from class: Timer
Returns the "calls per second". If this is called every frame, then it will return the "frames per second".

Specified by:
getFrameRate in class Timer
Returns:
The "calls per second".

getTimePerFrame

public float getTimePerFrame()
Description copied from class: Timer
Returns the time, in seconds, between the last call and the current one.

Specified by:
getTimePerFrame in class Timer
Returns:
Time between this call and the last one.

update

public void update()
Description copied from class: Timer
update recalculates the frame rate based on the previous call to update. It is assumed that update is called each frame.

Specified by:
update in class Timer

reset

public void reset()
Description copied from class: Timer
Reset the timer to 0. Clear any tpf history.

Specified by:
reset in class Timer