ProtoProxy: Uses cTimer for the timing information.
Previously used clock() is not suitable for the task, unfortunately it worked in MSVC.
This commit is contained in:
parent
86eb71868b
commit
3c0e08ee71
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -143,6 +143,7 @@ typedef short Int16;
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user