Skip to content

Commit

Permalink
Stopwatch now works correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Aug 25, 2013
1 parent 4fa0883 commit 99cbfb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/Client/GameMapWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace spades {
}
}

printf("GameMapWrapper: %.3f msecs to rebuild\n",
SPLog("%.3f msecs to rebuild",
stopwatch.GetTime() * 1000.);

}
Expand Down
8 changes: 5 additions & 3 deletions Sources/Core/Stopwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@

#ifdef WIN32
#include <windows.h>
static uint64_t GetSWTicks() {
static double GetSWTicks() {
LARGE_INTEGER val, freq;
QueryPerformanceCounter(&val);
QueryPerformanceFrequency(&freq);
if(QueryPerformanceFrequency(&freq) == 0 || freq.QuadPart == 0 ||
QueryPerformanceCounter(&val) == 0 || val.QuadPart == 0){
return (uint64_t)GetTickCount() / 1000.;
}
return (double)val.QuadPart / (double)freq.QuadPart;
}
#else
Expand Down

0 comments on commit 99cbfb5

Please sign in to comment.