GetMicrosecondsSinceStart( bool bAccurate )

This commit is contained in:
Glenn Maynard
2004-06-11 00:34:04 +00:00
parent 408e8f7b8b
commit 49446552c9
3 changed files with 19 additions and 4 deletions
+17 -2
View File
@@ -23,8 +23,23 @@ public:
virtual void SetTime( tm newtime ) { } virtual void SetTime( tm newtime ) { }
/* */ /*
virtual int64_t GetMicrosecondsSinceStart() = 0; * Return the amount of time since the program started. (This may actually be
* since the initialization of HOOKS.
*
* Full microsecond accuracy may not be available.
*
* bAccurate is a hint: it specifies whether to prefer short-term precision
* or long-term accuracy. If false, the implementation may give higher resolution
* results, but not be as stable over long periods (eg. may drift depending on
* clock speed shifts on laptops). If true, lower precision results (usually with
* no less than a 1ms granularity) are returned, but the results should be stable
* over long periods of time.
*
* Note that bAccurate may change the result significantly; it may use a different
* timer, and may have a different concept of when the program "started".
*/
virtual int64_t GetMicrosecondsSinceStart( bool bAccurate ) = 0;
}; };
ArchHooks *MakeArchHooks(); ArchHooks *MakeArchHooks();
@@ -185,7 +185,7 @@ void ArchHooks_Win32::SetTime( tm newtime )
SetLocalTime( &st ); SetLocalTime( &st );
} }
int64_t ArchHooks_Win32::GetMicrosecondsSinceStart() int64_t ArchHooks_Win32::GetMicrosecondsSinceStart( bool bAccurate )
{ {
static bool bInitialized; static bool bInitialized;
static DWORD iStartTime; static DWORD iStartTime;
@@ -17,7 +17,7 @@ public:
void EnterTimeCriticalSection(); void EnterTimeCriticalSection();
void ExitTimeCriticalSection(); void ExitTimeCriticalSection();
void SetTime( tm newtime ); void SetTime( tm newtime );
int64_t GetMicrosecondsSinceStart(); int64_t GetMicrosecondsSinceStart( bool bAccurate );
private: private:
void CheckVideoDriver(); void CheckVideoDriver();