NetworkTime: more readable ping interval check

This commit is contained in:
mischa 2023-07-06 16:33:08 +08:00
parent 08fa0269de
commit a463d48681

View File

@ -92,7 +92,7 @@ public static void ResetStatics()
internal static void UpdateClient() internal static void UpdateClient()
{ {
// localTime (double) instead of Time.time for accuracy over days // localTime (double) instead of Time.time for accuracy over days
if (localTime - lastPingTime >= PingFrequency) if (localTime >= lastPingTime + PingFrequency)
{ {
NetworkPingMessage pingMessage = new NetworkPingMessage(localTime); NetworkPingMessage pingMessage = new NetworkPingMessage(localTime);
NetworkClient.Send(pingMessage, Channels.Unreliable); NetworkClient.Send(pingMessage, Channels.Unreliable);