diff options
author | Mattes D <github@xoft.cz> | 2014-12-07 15:01:36 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-12-07 15:01:36 +0100 |
commit | d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21 (patch) | |
tree | b0dbd8a8396ad22cf77cb4b367295d25ad3055a7 /src/ClientHandle.h | |
parent | Reduced river height (diff) | |
parent | Merge remote-tracking branch 'origin/master' into c++11 (diff) | |
download | cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.gz cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.bz2 cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.lz cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.xz cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.tar.zst cuberite-d00ebd7ee700fcd7f30ea27d238ba1f0d56dfe21.zip |
Diffstat (limited to 'src/ClientHandle.h')
-rw-r--r-- | src/ClientHandle.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ClientHandle.h b/src/ClientHandle.h index f195b6be7..3431e3a71 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -215,7 +215,7 @@ public: const AString & GetUsername(void) const; void SetUsername( const AString & a_Username); - inline short GetPing(void) const { return m_Ping; } + inline short GetPing(void) const { return static_cast<short>(std::chrono::duration_cast<std::chrono::milliseconds>(m_Ping).count()); } /** Sets the maximal view distance. */ void SetViewDistance(int a_ViewDistance); @@ -378,11 +378,11 @@ private: /** Seconds since the last packet data was received (updated in Tick(), reset in DataReceived()) */ float m_TimeSinceLastPacket; - short m_Ping; + std::chrono::steady_clock::duration m_Ping; int m_PingID; - long long m_PingStartTime; - long long m_LastPingTime; - static const unsigned short PING_TIME_MS = 1000; // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms) + std::chrono::steady_clock::time_point m_PingStartTime; + std::chrono::steady_clock::time_point m_LastPingTime; + std::chrono::milliseconds PING_TIME_MS = std::chrono::milliseconds(1000); // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms) // Values required for block dig animation int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging |