Which function for timestamp to sync clients


I would like to synchronize the moment when a player started casting a spell. Meaning when the server tells the client that a spell started, the client is already lagging behind, and I would like to make sure the clients account for that. So I would like to send from the server to client: “Hey the spell-cast started at Time XY” and the clients go “hey this was 200 ms ago, so the spell is already 10% finished”.

So which is the right C++ function for this purpose? I see there is GetGameTimeInSeconds, but does this one give identical results between clients and servers? Or is there another function I should use?

Thanks in advance

GetServerWorldTimeSeconds” is the most accurate you’ll find in the engine. Yet it isn’t accurate enough for what you want to do. It can be off by a second or two in some instances.

You have to write your own Network clock for higher accuracy/syncing.

Thanks for the explanation and the link, looks promising! I will work this through and see if I can use it!