Skip to content

Commit

Permalink
GetTickCount on Windows to return tick count of server instead of system
Browse files Browse the repository at this point in the history
  • Loading branch information
Hual committed Sep 23, 2024
1 parent 14c7971 commit 0c10a13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Server/Source/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct IUnknown;
#define LIBRARY_OPEN(path) LoadLibrary(path)
#define LIBRARY_GET_ADDR GetProcAddress
#define LIBRARY_FREE FreeLibrary
static LARGE_INTEGER initialTime;
static LARGE_INTEGER yo;
#define BUILD_WINDOWS
#else
Expand Down Expand Up @@ -118,6 +119,7 @@ unsigned GetTickCount()
{
#ifdef BUILD_WINDOWS
QueryPerformanceFrequency(&yo);
QueryPerformanceCounter(&initialTime);
#else
gettimeofday(&initialTime, 0);
#endif
Expand All @@ -129,7 +131,7 @@ unsigned GetTickCount()

QueryPerformanceCounter(&PerfVal);

return (unsigned)(PerfVal.QuadPart * 1000 / yo.QuadPart);
return (unsigned)((PerfVal.QuadPart - initialTime.QuadPart) * 1000 / yo.QuadPart);
#else
struct timeval tp;
gettimeofday(&tp, 0);
Expand Down

0 comments on commit 0c10a13

Please sign in to comment.