Is os.time synced between client and server

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I would like to know if os.time is synced between client and server

  2. What is the issue? Include screenshots / videos if possible!
    I don’t know whether they are or not

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have looked at the api for the os library


looks synced to me
the first number is the number of times it executed the second number is os.time()

os.time() returns the time (in seconds since the epoch) on the current device, so yes if you play in studio they will be synced (because the client and the server are the same computer).

However if the server and the client are in different time zones or the user’s system clock is early/behind then they will be different.

what would be a good alternative then

What do you need the times for?

just a general purpose synced countdown

My mistake, os.time() doesn’t return the time in the local timezone (though still possibly early/late on the client)

(Also the Roblox staff said that you should use the DateTime API instead)

So basically you could either do:

  1. Send the end time to the client
    (But if the client’s clock is ahead or behind the timer will be aswell)

  2. Send the remaining amount of time to the client
    (But the timer will be behind by the amount of ping the client has)
    (You could try to get around this by removing the ping from the remaining time, but it will never be perfectly accurate)

The result of os.time() is based on the device’s local clock. They are usually in sync within a few seconds because most OSes by default synchronize their clock over the internet. This isn’t 100% reliable though. For example, anyone can go into their time and date settings and manually change the current date of their OS.

For truly synchronized time between client and server, you can use Workspace:GetServerTimeNow() instead. This API tries to be very tightly synchronized, and has microsecond granularity.

The returned value of GetServerTimeNow is a unix timestamp, similar to os.time(). So to turn it into a human readable date you can pass it into existing APIs like DateTime.fromUnixTimestamp and