Os.time() does not return correct UTC time on client

os.time() returns different values on the client and server. This bug occurs in live games as well as studio

Server print: https://gyazo.com/94bccf342f89a6ba36c7d97c44e03917
Client print: https://gyazo.com/fdaa2bfc98386b451e3aad9e26d43121

The client returns a time that is exactly 2 hours ahead of my local time. However UTC time is 6 hours ahead of my time zone. For some reason os.date(“!*t”).hour returns the correct UTC hour on the client.

10 Likes

I can vouch for this, some players devices are very much out of proportion with the server. Will be able to clarify what device this was (since this seems to be device dependent)

2 Likes

While this seems to be unintended (according to the Dev Hub), it is useful to get the user’s local time. We just did a live event in my game and some parts of it relied on the user’s local time.

4 Likes

Although this wouldn’t solve this bug directly, I would recommend you check out the DateType datatype as I have found it far easier to work with when dealing with time compared to tick() or os.time().

2 Likes

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

3 Likes

We currently do not have a clock where we guarantee the value will be the same on the client and the server.

3 Likes

I can confirm it does not return the correct time for me, either.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.