问题
In my Roblox place, I want to get a value representing the current time which is consistent across all running servers and places in my game.
I already know about the Time function, but the documentation for that function seems to indicate that it is only consistent across a single place (or perhaps only a single place instance?):
Returns returns the current place time in seconds.
There's also tick:
Returns the time in UNIX time, which is the number of seconds since the Unix epoch, January 1st, 1970.
But that has another issue:
Because some servers run in different timezones (such as servers in America and Europe), tick() will return a different time on those servers. This time will differ in several hours, as much as the time zone difference is. Due this fact, it cannot say anything about relative times between two servers (such as measuring how long it has taken since the last visit of the player).
How do I get a time value that's consistent across all servers and places in my game? (The actual time in real life would work well for this purpose.)
解决方法
The Roblox Wiki article discussing tick has recently been updated to include some additional information which answers my question:
Warning: tick() returns local time, and time zones between servers may vary. A reliable option to get the same time on every server is to call os.time().
After Googling for os.time(), I discovered that it's actually part of the standard library for the LUA language. More information about os and os.time can be found here: