|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.tudey.client.util.TimeSmoother
public class TimeSmoother
Provides a continuous estimate of the current time (with millisecond precision) based on a series of discrete time updates, speeding up or slowing down (but never reversing) the local clock as necessary to stay in synch.
| Field Summary | |
|---|---|
protected long |
_delta
The current estimated difference between the tracked time and the timer time. |
protected long |
_dstamp
The timestamp of the current delta value. |
protected long |
_tdelta
The target delta. |
protected static float |
CONVERGENCE_RATE
The exponential rate at which we approach our target delta. |
| Constructor Summary | |
|---|---|
TimeSmoother(int time)
Creates a new smoother with the given initial clock value. |
|
| Method Summary | |
|---|---|
int |
getTime()
Returns the current smoothed time estimate. |
void |
update(int time)
Updates the smoother with the current value of the clock being tracked. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected long _delta
protected long _tdelta
protected long _dstamp
protected static final float CONVERGENCE_RATE
| Constructor Detail |
|---|
public TimeSmoother(int time)
| Method Detail |
|---|
public void update(int time)
public int getTime()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||