X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FMacCompatibility.cpp;h=dc1ad47ede75df9ef573d30f74f97b681724282f;hp=65a4c5ff78de9fc0c740cae66b4a0581e10e78e9;hb=8b6e8f3ad7390309795eb35c0959264cb7924402;hpb=531fd8d27258d6c15d6fd221272c74b48602a85a diff --git a/Source/MacCompatibility.cpp b/Source/MacCompatibility.cpp index 65a4c5f..dc1ad47 100644 --- a/Source/MacCompatibility.cpp +++ b/Source/MacCompatibility.cpp @@ -21,10 +21,10 @@ along with Lugaru. If not, see . #include "MacCompatibility.hpp" #include -#include #include #include #include +#include #ifdef WIN32 #include @@ -32,38 +32,39 @@ along with Lugaru. If not, see . #if PLATFORM_UNIX #include -#include #include #include +#include typedef long long __int64; typedef __int64 LARGE_INTEGER; -static int QueryPerformanceFrequency(LARGE_INTEGER *liptr) +static int QueryPerformanceFrequency(LARGE_INTEGER* liptr) { - assert(sizeof (__int64) == 8); - assert(sizeof (LARGE_INTEGER) == 8); + assert(sizeof(__int64) == 8); + assert(sizeof(LARGE_INTEGER) == 8); *liptr = 1000; - return(1); + return (1); } -static int QueryPerformanceCounter(LARGE_INTEGER *liptr) +static int QueryPerformanceCounter(LARGE_INTEGER* liptr) { struct timeval tv; gettimeofday(&tv, NULL); - *liptr = ( (((LARGE_INTEGER) tv.tv_sec) * 1000) + - (((LARGE_INTEGER) tv.tv_usec) / 1000) ); - return(1); + *liptr = ((((LARGE_INTEGER)tv.tv_sec) * 1000) + + (((LARGE_INTEGER)tv.tv_usec) / 1000)); + return (1); } #endif class AppTime { -public: - AppTime() { + public: + AppTime() + { counterRate = 1; baseCounter = 0; - QueryPerformanceFrequency( (LARGE_INTEGER*)&counterRate); - QueryPerformanceCounter( (LARGE_INTEGER*)&baseCounter); + QueryPerformanceFrequency((LARGE_INTEGER*)&counterRate); + QueryPerformanceCounter((LARGE_INTEGER*)&baseCounter); } __int64 counterRate; // LARGE_INTEGER type has no math functions so use int64 __int64 baseCounter; @@ -73,7 +74,7 @@ static AppTime g_appTime; AbsoluteTime UpTime() { __int64 counter; - QueryPerformanceCounter( (LARGE_INTEGER*)&counter); + QueryPerformanceCounter((LARGE_INTEGER*)&counter); counter -= g_appTime.baseCounter; @@ -83,8 +84,7 @@ AbsoluteTime UpTime() return time; } - -Duration AbsoluteDeltaToDuration( AbsoluteTime& a, AbsoluteTime& b) +Duration AbsoluteDeltaToDuration(AbsoluteTime& a, AbsoluteTime& b) { __int64 value = a.hi; value <<= 32;