PhotonNetwork.ServerTimestamp reads completely different values
The whole answer can be found below.
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).
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
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!
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.
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