ArchHooks_Unix::GetMicrosecondsSinceStart

This commit is contained in:
Glenn Maynard
2004-06-11 00:33:02 +00:00
parent db40860b65
commit 408e8f7b8b
2 changed files with 10 additions and 0 deletions
@@ -8,6 +8,7 @@
#include "archutils/Unix/LinuxThreadHelpers.h" #include "archutils/Unix/LinuxThreadHelpers.h"
#include <unistd.h> #include <unistd.h>
#include "RageUtil.h" #include "RageUtil.h"
#include <sys/time.h>
#if defined(CRASH_HANDLER) #if defined(CRASH_HANDLER)
#include "archutils/Unix/CrashHandler.h" #include "archutils/Unix/CrashHandler.h"
@@ -134,6 +135,14 @@ void ArchHooks_Unix::SetTime( tm newtime )
system( "hwclock --systohc" ); system( "hwclock --systohc" );
} }
int64_t ArchHooks_Unix::GetMicrosecondsSinceStart()
{
struct timeval tv;
gettimeofday( &tv, NULL );
return int64_t(tv.tv_sec) * 1000000 + int64_t(tv.tv_usec);
}
/* /*
* (c) 2003-2004 Glenn Maynard * (c) 2003-2004 Glenn Maynard
* All rights reserved. * All rights reserved.
@@ -9,6 +9,7 @@ public:
void DumpDebugInfo(); void DumpDebugInfo();
void SetTime( tm newtime ); void SetTime( tm newtime );
int64_t GetMicrosecondsSinceStart();
}; };
#undef ARCH_HOOKS #undef ARCH_HOOKS