What time system should I use?

Hello!

I’m here to ask what time system I should use. I used to use tick(), which worked perfectly, but since it’s been deprecated, I’m now using os.time(). Unfortunately, I’m not very happy with it. Its resolution is only to the second, which causes mismatched timing in the UI and other elements.

Is there a time system with the same resolution as tick() that I could use instead?

Thanks!

1 Like

os.clock() is your best option, as it calculates time to as near precision as tick(). The only difference is that it returns the amount of CPU time Lua uses, unlike the amount of time since Jan 1, 1970.

Also, tick() is not fully yet deprecated, but Roblox is slowly starting to not support it anymore, so it is recommended you switch.

Hope this helps! :slight_smile:

1 Like

You probaby replaced tick() with os.time() because they look like the same by their descriptions.

But I think you should replace tick() with os.clock() instead if you want something similar.

“This value has high precision, about 1 microsecond, making this a very good substitute for the now somewhat deprecated tick() function.”

1 Like

use DateTime.now().UnixTimestampMillis / 1000
it is better option than tick
DateTime | Documentation - Roblox Creator Hub

1 Like

For what though? You have no specified use case.