net.java.joglutils.msg.misc
Class SystemTime

java.lang.Object
  extended by net.java.joglutils.msg.misc.SystemTime
All Implemented Interfaces:
Time

public class SystemTime
extends Object
implements Time

Implementation of Time interface based on System.currentTimeMillis. Performs smoothing internally to avoid effects of poor granularity of currentTimeMillis on Windows platform in particular.


Constructor Summary
SystemTime()
           
 
Method Summary
 double deltaT()
          Time in seconds since last update.
 int getNumSmoothingSamples()
          Returns number of smoothing samples; default is 10.
 void rebase()
          Rebases this timer.
 void setNumSmoothingSamples(int num)
          Sets number of smoothing samples.
 double time()
          Time in seconds since beginning of application.
 void update()
          Updates this Time object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemTime

public SystemTime()
Method Detail

setNumSmoothingSamples

public void setNumSmoothingSamples(int num)
Sets number of smoothing samples. Defaults to 10. Note that there may be a discontinuity in the reported time after a call to this method.


getNumSmoothingSamples

public int getNumSmoothingSamples()
Returns number of smoothing samples; default is 10.


rebase

public void rebase()
Rebases this timer. After very long periods of time the resolution of this timer may decrease; the application can call this to restore higher resolution. Note that there may be a discontinuity in the reported time after a call to this method.


update

public void update()
Description copied from interface: Time
Updates this Time object. Call update() each frame before calling the accessor routines.

Specified by:
update in interface Time

time

public double time()
Description copied from interface: Time
Time in seconds since beginning of application.

Specified by:
time in interface Time

deltaT

public double deltaT()
Description copied from interface: Time
Time in seconds since last update.

Specified by:
deltaT in interface Time