How can I get room creation time

Because PhotonNetwork.time is incorrect sometimes I cant use CustomRoomProperties to set room creation time

I just need it to make SYNCED ROOM TIME

So is there another way to get it

Best Answer

  • Accepted Answer
    I should try using NTP server to set my 'room start time'

Answers

  • Hi @THE_LINE_IO,

    what do you mean exactly when saying that PhotonNetwork.time is incorrect sometimes?

    You can try fetching the ServerTimestamp again manually before creating and / or joining the room by calling PhotonNetwork.FetchServerTimestamp(). This can be done e.g. in a Coroutine because you have to wait for the result. Afterwards you can use PhotonNetwork.ServerTimestamp in order to access this value.
  • edited July 2017
    Not working.
    The issue is that PhotonNetwork.ServerTimestamp and PhotonNetwork.time are getting changed when i join room
    so i get diffrent values.

  • Accepted Answer
    I should try using NTP server to set my 'room start time'
  • yes this is ridicoluous

    Not working.
    The issue is that PhotonNetwork.ServerTimestamp and PhotonNetwork.time are getting changed when i join room
    so i get diffrent values.

  • Hi @0xhex,

    this is a wanted behaviour. When the client joins the room, the time gets synchronized with the server's time. PhotonNetwork.ServerTimestamp and PhotonNetwork.time are basically returning the same value whereat ServerTimestamp is an int value and time is a double value.
Sign In or Register to comment.