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:
Glenn Maynard
2004-08-15 22:40:55 +00:00
parent c9fc2ebfe7
commit 3776d4a13f
4 changed files with 24 additions and 4 deletions
@@ -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;
}
/*