cleanup low-level time handling: only make adjustments to the clock that
the arch really needs; Unix gettimeofday does not loop like Win32 timeGetTime so don't mess with it
This commit is contained in:
@@ -143,7 +143,10 @@ static int64_t GetMicrosecondsSinceEpoch()
|
||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
{
|
||||
static int64_t iStartTime = GetMicrosecondsSinceEpoch();
|
||||
return GetMicrosecondsSinceEpoch() - iStartTime;
|
||||
int64_t ret = GetMicrosecondsSinceEpoch() - iStartTime;
|
||||
if( bAccurate )
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -203,7 +203,14 @@ int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
if( !g_bTimerInitialized )
|
||||
InitTimer();
|
||||
|
||||
return (timeGetTime() - g_iStartTime) * 1000;
|
||||
int64_t ret = (timeGetTime() - g_iStartTime) * int64_t(1000);
|
||||
if( bAccurate )
|
||||
{
|
||||
ret = FixupTimeIfLooped( ret );
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,7 +19,14 @@ int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
if( !g_bTimerInitialized )
|
||||
InitTimer();
|
||||
|
||||
return (timeGetTime() - g_iStartTime) * 1000;
|
||||
int64_t ret = (timeGetTime() - g_iStartTime) * int64_t(1000);
|
||||
if( bAccurate )
|
||||
{
|
||||
ret = FixupTimeIfLooped( ret );
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ArchHooks_Xbox::ArchHooks_Xbox()
|
||||
|
||||
@@ -298,7 +298,10 @@ static int64_t GetMicrosecondsSinceEpoch()
|
||||
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||
{
|
||||
static int64_t iStartTime = GetMicrosecondsSinceEpoch();
|
||||
return GetMicrosecondsSinceEpoch() - iStartTime;
|
||||
int64_t ret = GetMicrosecondsSinceEpoch() - iStartTime;
|
||||
if( bAccurate )
|
||||
ret = FixupTimeIfBackwards( ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user