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 on PUN.

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.

PhotonNetwork.ServerTimestamp reads completely different values

Vasan_Routh
2021-07-07 06:40:55

I read a discussion that using PhotonNetwork.ServerTimestamp can replace wrapping issues in PhotonNetwork.Time. So after implementing PhotonNetwork.ServerTimestamp I get this value when I am outside the room "187996267", and after joining the room I receive "-1687035466". Both values are completely different, what is the reason for that? anyone, please explain it.

Comments

Tobias
2021-07-07 08:45:12

The value is "per server" and during matchmaking the client will change servers. All players who are in the same room, will use the same server and should get (about) the same value.

Vasan_Routh
2021-07-07 13:20:05

Okay, now I got that! Confused because of the negative value that it's returning. But it doesn't mess around with the timer, now it's working fine thanks!

steamcore
2021-08-01 05:51:01

OH CRAP. I am using this value in conjunction with Photon.Chat to save some stats on a match that you can "resume" by re-entering the room. If you do this after all players leave, it still recreates the cached state and lets you back into the photon room. I have been seeing crazy values not explained by wrap-around, and this is it. I guess I'll go to some other authoritative (gmt based) time service.

Tobias
2021-08-03 08:43:50

Vasan: Negative values are not a problem as such, as long as you calculate the difference between any two timestamps, this will be a positive number (substract the older time from the newer) and the correct delta.

Steamcore: Right. If you recreate a room, after it was removed, there is no guarantee it will end up on the same server again, so timestamps no longer make sense.

Back to top