Jump to content
Sign in to follow this  
roguetrooper

How close are server time and client time?

Recommended Posts

Since I can't investigate that at home alone on my own, I'm asking here.

1.) How closely are server time and client time synchronized? Is there more than a tenth second difference? The command "time" returns the time since map start to the third decimal place.

2.) Concerning Dr Eyeball's comment in the wiki for "time": can you act on the assumption that about 10 seconds after JIP the client has the "time" (not "daytime") the server has?

Share this post


Link to post
Share on other sites

I tried the investigating bit. JIP seemed to sync before the first second. Maybe it's related to server load? Or to my test method (init.sqf):

player_time_at_the_beginning_of_init = time;
_check = 0;
while {_check < 10} do
{
call compile format ["player_time_at_%1s = time", _check];
_check = _check + 1; sleep 1;
};

Afterwards the client and server time values quickly got separated by dozens of seconds, with apparently no further synchronisation after connecting to the server (in line with teaCup's comment in the wiki). Edit: Also, when I went to the server the first time to load the mission, the difference between the admin client time and the server time was around 6s even initially.

I know public variables aren't a good way to test this, but it was easy to show and the values seemed to be within 0.2 of the stuff I printed to server log. Image 2

(serverTime shows the uptime of arma3server.exe)

Edited by Magirot

Share this post


Link to post
Share on other sites

Thanks for your extended testing and letting me know.

Edit: What do you (and others) think is the best method to have something happen as synchronously as possible (within a range of tenth seconds or fewer) on the server and all clients?

Using PublicVariable? Servertime?

With serverTime there also seem to be some issues (wiki):

The only time it is not synced is on the server, right after server restart and only for the first 300 seconds.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites
Edit: What do you (and others) think is the best method to have something happen as synchronously as possible (within a range of tenth seconds or fewer) on the server and all clients?

Using PublicVariable?

I'd say this, but I'm not sure if it'll get to 1/10 of a second, in my experience it usually takes somewhere between 0.2-0.5s (at least when you count the time it takes for triggers / waitUntil to catch up - I don't know if addPublicVariableEventHandler is better in that regard). It might also be worse on servers under heavy load. Maybe someone else knows more.

I doubt serverTime is any more reliable than time.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×