DistributedGameTime is not distributed

The DistributedGameTime property of the Workspace does not seem to be distributed. It seems to return the value since the local game started running.

Tested by starting a local server, some time later connecting a player to it and then printing the value of this property and os.time(), in the default baseplace place. Comparing the value of os.time() and DistributedGameTime shows that it’s… not distributed.

Would like to see this fixed since this is quite essential to synchronize things between clients, because os.time() is not accurate enough for those purposes.

1 Like

That’s strange.

Also, I thought that os was set to nil in roblox lua?

Only os.time and os.difftime are accessible. os.time is (supposed to be) consistent across all servers, regardless of their timezone.

Yeah, I’ve noticed this since I needed a time that i could use to track latency of a request to the server. I ended up updating a number value in ReplicatedStorage…

Issue is that that’s still affected by the lag of updating the number, which is far from optional if you want a constantly fairly accurate time number.

I suspect DistrubutedGameTime has client-sided prediction of the time as well to neutralize the lag between the server and clients (I hope it does), so it’s always trying to represent the server time as closely as possible using fancy calculations, which depends on the lag between the server and client.

Creating such a system yourself, which also accounts for lag, is not that straight-forward and would be affected by the Lua overhead as well.

1 Like