summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 19:59:40 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 19:59:40 +0200
commitbde99d684e0bb51adaa053a240abe61cf4af07fb (patch)
treead1111d21ee606dd3cd60439189a92b1b51e2dea /src/ClientHandle.h
parentMigrated random generators to std::random (diff)
downloadcuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar.gz
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar.bz2
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar.lz
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar.xz
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.tar.zst
cuberite-bde99d684e0bb51adaa053a240abe61cf4af07fb.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index 9733ff32d..ef7974efd 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -210,7 +210,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()); }
void SetViewDistance(int a_ViewDistance);
int GetViewDistance(void) const { return m_ViewDistance; }
@@ -367,11 +367,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