|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.dobj.DObject
com.threerings.presents.data.TimeBaseObject
public class TimeBaseObject
Used to communicate time bases to clients so that more efficient delta times can be transmitted over the network. Two time stamps are maintained: even and odd. When the even time base is sufficiently old that our delta time container (usually a short or an int) will exceed its maximum value, we switch to the odd time base. The bouncing between two separate values prevents problems from arising when the base time is changed, yet values using the old base time might still be propagating through the system.
Note that for sufficiently small delta time containers, stale values could still linger longer than the time required for two swaps (two byte delta stamps for example, must swap every 30 seconds).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
Streamable.Closure |
| Field Summary | |
|---|---|
static String |
EVEN_BASE
The field name of the evenBase field. |
long |
evenBase
The even time base, used to decode even delta times. |
static String |
ODD_BASE
The field name of the oddBase field. |
long |
oddBase
The odd time base, used to decode odd delta times. |
| Fields inherited from class com.threerings.presents.dobj.DObject |
|---|
_accessors, _atable, _controller, _deathWish, _listeners, _locattrs, _locks, _oid, _omgr, _scount, _subs, _tcancelled, _tcount, _tevent |
| Constructor Summary | |
|---|---|
TimeBaseObject()
|
|
| Method Summary | |
|---|---|
long |
fromDelta(int delta)
Converts the supplied delta time back to a wall time based on the base time in this time base object. |
protected long |
getDelta(long timeStamp,
long maxValue)
Obtains a delta with the specified maximum value, swapping from even to odd, if necessary. |
void |
setEvenBase(long value)
Requests that the evenBase field be set to the
specified value. |
void |
setOddBase(long value)
Requests that the oddBase field be set to the
specified value. |
int |
toIntDelta(long timeStamp)
Converts the supplied time stamp into a time delta (measured relative to the appropriate time base, even or odd) with maximum value of 2^31. |
short |
toShortDelta(long timeStamp)
Converts the supplied time stamp into a time delta (measured relative to the appropriate time base, even or odd) with maximum value of 2^15. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String EVEN_BASE
evenBase field.
@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String ODD_BASE
oddBase field.
public long evenBase
public long oddBase
| Constructor Detail |
|---|
public TimeBaseObject()
| Method Detail |
|---|
public short toShortDelta(long timeStamp)
public int toIntDelta(long timeStamp)
public long fromDelta(int delta)
protected long getDelta(long timeStamp,
long maxValue)
@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setEvenBase(long value)
evenBase field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.
@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setOddBase(long value)
oddBase field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||