views:

21

answers:

2

Ok, so the situation is as follows.

I have a server with services for a game, a particular command from the server sends a timestamp for when the next game round should commence. To get this perfectly synced on all connected clients I also have a webbservice that returns a timestamp of the servers current time.

What I know: the time between request sent and answer recieved. What I dont know: where the latency lies, on client processing or server processing or bandwidth issues.

What is the best practice to get a reasonable result here. I guess that GPS must have solved this in some fashion but I´ve been unable to find a good pattern.

What I do now is to add half the latency of the request to the server timestamp, but it's not quite good enough. This may have to do that the time between send and recieve can be as high as 11 seconds.

Suggestions?

A: 

There're many common solutions to sync time between machines, including correct PLL implementation done by NTPD with RTP. This is useful to you if you can change machine's local time. If not, perhaps you should do more or less what you did, but drop sync points where the latency is unreasonable.

Pavel Radzivilovsky
thanks for the answer!
Tobias
thanks for the votes :)
Pavel Radzivilovsky
It turned out that the webservice could be forced to send the answer right away and so we managed to get the latency down within tolerant ranges, phwew... seemed easier that way ;)
Tobias
A: 

The best practice is usually not to synchronise the absolute times but to work with relative times instead.

Kylotan