Server time

Okay so i’m working on a script and the problem im facing is making sure the clients are syncronized on the execution of the program. so i’m simply thinking of timestamping the data since the communication occurs through a method which is basically announces it. I did take a look into the gmod wiki but found nothing, An alternative way i came up with to track the data’s age would be a legacy counter: All the clients would just copy and add 1 to the highest integer until it autoresets. But i’m not sure how effective this would be and with the whole syncronizing policy the network could be easily broken by constantly autoreseting it or creating big distances between the integers to create an illusion of old data and thus preventing communication.

**[G.CurTime

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.CurTime)**?

“Affected by host_timescale. (e.g. setting it to 0.5 makes CurTime() go twice as slow)”
Nice try, but host_timescale could fuck things up even unintentionally.

That is probably your best bet, G.CurTime has the feature to be completely synced between the server and the client. (even if host_timescale is altered, tbh I don’t really see your point in host_timescale).

Most of the other time related functions will only receive it from the OS / whenever the computer started gmod unlike CurTime.

Well i’ll probably go with it then. Thanks.

You can use **[G.RealTime

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.RealTime)**. It’s exactly the same as CurTime but isn’t affected by host_timescale.

Except the fact that RealTime is not synced between the server and the client. They have different values if called from the server / client.