diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_darwin.cpp b/stepmania/src/arch/ArchHooks/ArchHooks_darwin.cpp index 8c935a8539..bf6c5b0707 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_darwin.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks_darwin.cpp @@ -14,6 +14,7 @@ #include #include #include +#include /* You would think that these would be defined somewhere. */ enum @@ -343,6 +344,20 @@ void ArchHooks_darwin::ExitTimeCriticalSection() LOG->Warn( "Time-critical section lasted for %f", fTimeCritLen ); } +static int64_t GetMicrosecondsSinceEpoch() +{ + struct timeval tv; + gettimeofday( &tv, NULL ); + + return int64_t(tv.tv_sec) * 1000000 + int64_t(tv.tv_usec); +} + +int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate ) +{ + static int64_t iStartTime = GetMicrosecondsSinceEpoch(); + return GetMicrosecondsSinceEpoch() - iStartTime; +} + /* * (c) 2003-2004 Steve Checkoway * All rights reserved.