simplify
This commit is contained in:
@@ -17,8 +17,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
int64_t ArchHooks_Unix::m_iStartTime = 0;
|
||||
|
||||
static bool IsFatalSignal( int signal )
|
||||
{
|
||||
switch( signal )
|
||||
@@ -107,10 +105,7 @@ static int64_t GetMicrosecondsSinceEpoch()
|
||||
|
||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
{
|
||||
if( ArchHooks_Unix::m_iStartTime == 0 )
|
||||
ArchHooks_Unix::m_iStartTime = GetMicrosecondsSinceEpoch();
|
||||
|
||||
int64_t ret = GetMicrosecondsSinceEpoch() - ArchHooks_Unix::m_iStartTime;
|
||||
int64_t ret = GetMicrosecondsSinceEpoch();
|
||||
if( bAccurate )
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
return ret;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
class ArchHooks_Unix: public ArchHooks
|
||||
{
|
||||
public:
|
||||
static int64_t m_iStartTime;
|
||||
ArchHooks_Unix();
|
||||
void DumpDebugInfo();
|
||||
|
||||
|
||||
@@ -226,7 +226,6 @@ void ArchHooks_Win32::SetupConcurrentRenderingThread()
|
||||
}
|
||||
|
||||
static bool g_bTimerInitialized;
|
||||
static DWORD g_iStartTime;
|
||||
|
||||
static void InitTimer()
|
||||
{
|
||||
@@ -235,7 +234,6 @@ static void InitTimer()
|
||||
g_bTimerInitialized = true;
|
||||
|
||||
timeBeginPeriod( 1 );
|
||||
g_iStartTime = timeGetTime();
|
||||
}
|
||||
|
||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
@@ -243,7 +241,7 @@ int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
if( !g_bTimerInitialized )
|
||||
InitTimer();
|
||||
|
||||
int64_t ret = (timeGetTime() - g_iStartTime) * int64_t(1000);
|
||||
int64_t ret = timeGetTime() * int64_t(1000);
|
||||
if( bAccurate )
|
||||
{
|
||||
ret = FixupTimeIfLooped( ret );
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "RageUtil.h"
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include "arch/ArchHooks/ArchHooks_Unix.h"
|
||||
|
||||
#if defined(LINUX)
|
||||
#include "archutils/Unix/LinuxThreadHelpers.h"
|
||||
@@ -231,13 +230,9 @@ bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
|
||||
}
|
||||
|
||||
timespec abstime;
|
||||
abstime.tv_sec = pTimeout->m_secs + ArchHooks_Unix::m_iStartTime/1000000;
|
||||
abstime.tv_nsec = (pTimeout->m_us + ArchHooks_Unix::m_iStartTime%1000000) * 1000;
|
||||
while(abstime.tv_nsec > 999999999)
|
||||
{
|
||||
abstime.tv_sec++;
|
||||
abstime.tv_nsec -= 1000000000;
|
||||
}
|
||||
abstime.tv_sec = pTimeout->m_secs;
|
||||
abstime.tv_nsec = pTimeout->m_us * 1000;
|
||||
|
||||
int iRet = pthread_cond_timedwait( &m_Cond, &m_pParent->mutex, &abstime );
|
||||
return iRet != ETIMEDOUT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user