diff options
author | Patric Stout <truebrain@openttd.org> | 2021-02-25 20:30:16 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-02-27 00:36:14 +0100 |
commit | 53c28a8ec9845a90f0c9e1ed83a87dbb7959d14d (patch) | |
tree | ec8b01761fd3c819d4e1317c86e7da37070b1152 /src/network/network_server.cpp | |
parent | dc7ba33b515c83ec0ebd9cb1789fd20294dee4ec (diff) | |
download | openttd-53c28a8ec9845a90f0c9e1ed83a87dbb7959d14d.tar.xz |
Codechange: [Network] replace _realtime_tick with std::chrono
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r-- | src/network/network_server.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index e03a60465..19e7d70dc 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1816,7 +1816,7 @@ void NetworkServer_Tick(bool send_frame) case NetworkClientSocket::STATUS_ACTIVE: if (lag > _settings_client.network.max_lag_time) { /* Client did still not report in within the specified limit. */ - IConsolePrintF(CC_ERROR, cs->last_packet + lag * MILLISECONDS_PER_TICK > _realtime_tick ? + IConsolePrintF(CC_ERROR, cs->last_packet + std::chrono::milliseconds(lag * MILLISECONDS_PER_TICK) > std::chrono::steady_clock::now() ? /* A packet was received in the last three game days, so the client is likely lagging behind. */ "Client #%d is dropped because the client's game state is more than %d ticks behind" : /* No packet was received in the last three game days; sounds like a lost connection. */ @@ -1827,11 +1827,11 @@ void NetworkServer_Tick(bool send_frame) } /* Report once per time we detect the lag, and only when we - * received a packet in the last 2000 milliseconds. If we + * received a packet in the last 2 seconds. If we * did not receive a packet, then the client is not just * slow, but the connection is likely severed. Mentioning * frame_freq is not useful in this case. */ - if (lag > (uint)DAY_TICKS && cs->lag_test == 0 && cs->last_packet + 2000 > _realtime_tick) { + if (lag > (uint)DAY_TICKS && cs->lag_test == 0 && cs->last_packet + std::chrono::seconds(2) > std::chrono::steady_clock::now()) { IConsolePrintF(CC_WARNING, "[%d] Client #%d is slow, try increasing [network.]frame_freq to a higher value!", _frame_counter, cs->client_id); cs->lag_test = 1; } |