The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

[Time] Getting the server-synced time?

wiseone
2022-03-15 20:23:28

Hi there,

How do I go about getting the actual time from the server? I cannot seem to find any timing references in the Photon Realtime's JavaScript API.

I need this to get the game room's start time to get the room's end time. And, also to synchronize object movements that have deterministic patterns, and the best way is to use time, to avoid having to broadcast it when we already have possible issues with suspending master actors.

I also need it for pinging, although this is optional since I can work around this. However, I cannot work around the time for when the game room will globally end, or for when setting the object's movement based on time.

I'm baffled, I cannot imagine making any network games without timing features, is this possible? Am I missing something?

Please let me know.

Thank you.

Comments

vadim
2022-03-16 14:48:22

Hi,

I just updated the SDK to version 4.1.1.3

The update includes new methods we introduced recently : getServerTimeMs(), syncServerTime(), getRtt(), updateRtt(). See documentation https://doc-api.photonengine.com/en/javascript/current/Photon.LoadBalancing.LoadBalancingClient.html

wiseone
2022-03-16 15:25:58

Hello,

Those are exactly the features I needed, thank you!

Back to top