public class DeltaCalculator extends Object
| Constructor and Description |
|---|
DeltaCalculator()
Constructs a delta calculator which is used to calculate the time
delta between the client and server, accounting reasonably well for
the delay introduced by sending a timestamp over the network from
the server to the client.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getTimeDelta()
Returns the best estimate client/server time-delta.
|
boolean |
gotPong(PongResponse pong)
Must be called when the pong response arrives back from the server.
|
boolean |
isDone()
Returns true if this calculator has enough data to compute a time
delta estimate.
|
void |
sentPing(PingRequest ping)
Must be called when a ping message is sent to the server.
|
boolean |
shouldSendPing()
Should we send another ping?
|
public DeltaCalculator()
public boolean shouldSendPing()
public void sentPing(PingRequest ping)
public boolean gotPong(PongResponse pong)
public long getTimeDelta()
public boolean isDone()
Copyright © 2015. All rights reserved.