#get_host_local_time(bool format) lua command

1 messages · Page 1 of 1 (latest)

burnt grove
#

Simple command that returns the host machine's current time in either 12 hour or 24 hour format depending on if it's given true/false, you could also possibly do a get_host_unix_time() that returns the host machines current unix timestamp.

#

Now that I think about it returning a value like get_hour() does would be much more useful then specifying 12 or 24 hour format

deft hemlock
# burnt grove Simple command that returns the host machine's current time in either 12 hour or...

The main issue with this (local time) is that because scripts are run locally, clients would need to know the host's current time. Assuming the host hasn't changed their clock, that would give anyone who joins the world a (very rough) estimate of the host's location based on the timezone.

eg. My timezone is EST, so if I modded my game and joined a world to see that the host's time is 5 hours ahead of mine, then I could say with pretty reasonable certainty that the host is most likely in or around the UK. It wouldn't be hard to do, either. Just mod the game to locally run a script that notifies the time.

That's something that I wouldn't really feel comfortable giving players access to. Even though it's a general region and not an exact location, a lot of people probably wouldn't want just anyone to able to know that info from just joining the game.

If scripts were server side then that wouldn't be as much of an issue, or if it was a script that just returns the current unix time like you suggested rather than the local time. But I just don't like the idea of it being local time.

There's also still the issue of making sure the time is actually synced. Since a lot of script stuff happens client side, if the value is even slightly different between the client and the host, it could desync things. It would be very hard to make them synced.

So until scripts are server side, I'm not sure if this is really feasible

burnt grove
#

We could also just return the current standard time and let people apply their timezone to it

burnt grove
#

Return specifically UTC+00:00 specifically

#

Though I personally think both UTC+00:00 and Unix would both be super helpful

burnt grove
#

@deft hemlock sorry to bother you, I'm helping James goes through the older suggestions and bug reports. I was curious what you thought about the idea of returning the base UTC so it wouldn't provide identifying information about the host?

deft hemlock
#

Returning UTC time would mean there's no location-specific info, but there's still the issue of syncing it between clients. eg. if the script runs for the host even just 50 ms before a client, the time returned would be different for both of them, which could cause the script to branch differently, and cascade into bad desyncs.
The only way I can think to fix that would be to network the exact time the script executes and adjust accordingly, but even that isn't a full solution since scripts run at different speeds for different clients. A player with a slower computer might query the time slightly after a player with a better computer, and thus still run the risk of desync, especially if the script loops.
That's a very nitpicky thing since if it's only accurate to the second, the chances of that actually happening are very low, but it is still a problem to be concerned with. So we'd have to think of a good solution for that.
Though to be fair, you can already query the current in-game time, which probably could run into the same problems. They just haven't really been apparent, probably because no one is using that for anything critical where the desyncs would be obvious.

#

Again, server side scripts would fix all of these problems, there's just other problems that would cause, so it isn't a simple switch

burnt grove
#

Yeah, get_hour() already has a bit of desync between players, I think it was desynced 2 decimal places out

deft hemlock
#

It depends on ping