summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-30 10:10:56 +0200
committermadmaxoft <github@xoft.cz>2013-08-30 10:10:56 +0200
commit3c0e08ee71221624ace7778e84ad80212c1615c1 (patch)
treebea0dfabb59c4c998a58e25016552ec61e51149d /Tools
parentRewritten cTimer not to use heap allocation. (diff)
downloadcuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar.gz
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar.bz2
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar.lz
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar.xz
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.tar.zst
cuberite-3c0e08ee71221624ace7778e84ad80212c1615c1.zip
Diffstat (limited to '')
-rw-r--r--Tools/ProtoProxy/Connection.cpp5
-rw-r--r--Tools/ProtoProxy/Connection.h5
-rw-r--r--Tools/ProtoProxy/Globals.h1
-rw-r--r--Tools/ProtoProxy/ProtoProxy.vcproj8
4 files changed, 14 insertions, 5 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 5a9300c2f..4e989d7ae 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -241,7 +241,7 @@ cConnection::cConnection(SOCKET a_ClientSocket, cServer & a_Server) :
m_Server(a_Server),
m_ClientSocket(a_ClientSocket),
m_ServerSocket(-1),
- m_BeginTick(clock()),
+ m_BeginTick(m_Timer.GetNowTime()),
m_ClientState(csUnencrypted),
m_ServerState(csUnencrypted),
m_Nonce(0),
@@ -478,8 +478,7 @@ bool cConnection::RelayFromClient(void)
double cConnection::GetRelativeTime(void)
{
- return (double)(clock() - m_BeginTick) / CLOCKS_PER_SEC;
-
+ return (double)(m_Timer.GetNowTime() - m_BeginTick) / 1000;
}
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index a310f62ae..c30a28727 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -9,8 +9,8 @@
#pragma once
-#include <time.h>
#include "ByteBuffer.h"
+#include "../../source/OSSupport/Timer.h"
@@ -35,7 +35,8 @@ class cConnection
SOCKET m_ClientSocket;
SOCKET m_ServerSocket;
- clock_t m_BeginTick; // Tick when the relative time was first retrieved (used for GetRelativeTime())
+ cTimer m_Timer;
+ long long m_BeginTick; // Tick when the relative time was first retrieved (used for GetRelativeTime())
enum eConnectionState
{
diff --git a/Tools/ProtoProxy/Globals.h b/Tools/ProtoProxy/Globals.h
index f2c47e96f..3b154b866 100644
--- a/Tools/ProtoProxy/Globals.h
+++ b/Tools/ProtoProxy/Globals.h
@@ -143,6 +143,7 @@ typedef short Int16;
#include <stdio.h>
#include <math.h>
#include <stdarg.h>
+#include <time.h>
diff --git a/Tools/ProtoProxy/ProtoProxy.vcproj b/Tools/ProtoProxy/ProtoProxy.vcproj
index 695e01e76..926bbe586 100644
--- a/Tools/ProtoProxy/ProtoProxy.vcproj
+++ b/Tools/ProtoProxy/ProtoProxy.vcproj
@@ -256,6 +256,14 @@
RelativePath="..\..\source\StringUtils.h"
>
</File>
+ <File
+ RelativePath="..\..\source\OSSupport\Timer.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\source\OSSupport\Timer.h"
+ >
+ </File>
</Filter>
<File
RelativePath=".\ProtoProxy.txt"