summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_game.cpp5
-rw-r--r--src/network/core/tcp_game.h3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index e0835771e..06e56e229 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -25,9 +25,10 @@
* @param s The socket to connect with.
*/
NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(nullptr), client_id(INVALID_CLIENT_ID),
- last_frame(_frame_counter), last_frame_server(_frame_counter), last_packet(_realtime_tick)
+ last_frame(_frame_counter), last_frame_server(_frame_counter)
{
this->sock = s;
+ this->last_packet = std::chrono::steady_clock::now();
}
/**
@@ -63,7 +64,7 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
{
PacketGameType type = (PacketGameType)p->Recv_uint8();
- this->last_packet = _realtime_tick;
+ this->last_packet = std::chrono::steady_clock::now();
switch (this->HasClientQuit() ? PACKET_END : type) {
case PACKET_SERVER_FULL: return this->Receive_SERVER_FULL(p);
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index 9e3dcf197..95b5f8c6c 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -16,6 +16,7 @@
#include "tcp.h"
#include "../network_type.h"
#include "../../core/pool_type.hpp"
+#include <chrono>
/**
* Enum with all types of TCP packets.
@@ -518,7 +519,7 @@ public:
uint32 last_frame; ///< Last frame we have executed
uint32 last_frame_server; ///< Last frame the server has executed
CommandQueue incoming_queue; ///< The command-queue awaiting handling
- uint last_packet; ///< Time we received the last frame.
+ std::chrono::steady_clock::time_point last_packet; ///< Time we received the last frame.
NetworkRecvStatus CloseConnection(bool error = true) override;