Skip to content

Commit

Permalink
tools: Add Win32 timers to codecbench
Browse files Browse the repository at this point in the history
This makes codecbench compile on Windows/MSVC
  • Loading branch information
zeux committed Apr 14, 2020
1 parent d0605a6 commit 6562d13
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tools/codecbench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ double timestamp()
{
return emscripten_get_now() * 1e-3;
}
#elif defined(_WIN32)
struct LARGE_INTEGER
{
__int64 QuadPart;
};
extern "C" __declspec(dllimport) int __stdcall QueryPerformanceCounter(LARGE_INTEGER* lpPerformanceCount);
extern "C" __declspec(dllimport) int __stdcall QueryPerformanceFrequency(LARGE_INTEGER* lpFrequency);

double timestamp()
{
LARGE_INTEGER freq, counter;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&counter);
return double(counter.QuadPart) / double(freq.QuadPart);
}
#else
double timestamp()
{
Expand Down

0 comments on commit 6562d13

Please sign in to comment.