|
|
|
@ -47,10 +47,10 @@ void _glfwInitTimer(void) |
|
|
|
|
if (QueryPerformanceFrequency((LARGE_INTEGER*) &freq)) |
|
|
|
|
{ |
|
|
|
|
// Performance counter is available => use it!
|
|
|
|
|
_glfwLibrary.Win32.timer.HasPerformanceCounter = GL_TRUE; |
|
|
|
|
_glfwLibrary.Win32.timer.hasPerformanceCounter = GL_TRUE; |
|
|
|
|
|
|
|
|
|
// Counter resolution is 1 / counter frequency
|
|
|
|
|
_glfwLibrary.Win32.timer.Resolution = 1.0 / (double) freq; |
|
|
|
|
_glfwLibrary.Win32.timer.resolution = 1.0 / (double) freq; |
|
|
|
|
|
|
|
|
|
// Set start time for timer
|
|
|
|
|
QueryPerformanceCounter((LARGE_INTEGER*) &_glfwLibrary.Win32.timer.t0_64); |
|
|
|
@ -58,10 +58,10 @@ void _glfwInitTimer(void) |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// No performace counter available => use the tick counter
|
|
|
|
|
_glfwLibrary.Win32.timer.HasPerformanceCounter = GL_FALSE; |
|
|
|
|
_glfwLibrary.Win32.timer.hasPerformanceCounter = GL_FALSE; |
|
|
|
|
|
|
|
|
|
// Counter resolution is 1 ms
|
|
|
|
|
_glfwLibrary.Win32.timer.Resolution = 0.001; |
|
|
|
|
_glfwLibrary.Win32.timer.resolution = 0.001; |
|
|
|
|
|
|
|
|
|
// Set start time for timer
|
|
|
|
|
_glfwLibrary.Win32.timer.t0_32 = _glfw_timeGetTime(); |
|
|
|
@ -82,7 +82,7 @@ double _glfwPlatformGetTime(void) |
|
|
|
|
double t; |
|
|
|
|
__int64 t_64; |
|
|
|
|
|
|
|
|
|
if (_glfwLibrary.Win32.timer.HasPerformanceCounter) |
|
|
|
|
if (_glfwLibrary.Win32.timer.hasPerformanceCounter) |
|
|
|
|
{ |
|
|
|
|
QueryPerformanceCounter((LARGE_INTEGER*) &t_64); |
|
|
|
|
t = (double)(t_64 - _glfwLibrary.Win32.timer.t0_64); |
|
|
|
@ -91,7 +91,7 @@ double _glfwPlatformGetTime(void) |
|
|
|
|
t = (double)(_glfw_timeGetTime() - _glfwLibrary.Win32.timer.t0_32); |
|
|
|
|
|
|
|
|
|
// Calculate the current time in seconds
|
|
|
|
|
return t * _glfwLibrary.Win32.timer.Resolution; |
|
|
|
|
return t * _glfwLibrary.Win32.timer.resolution; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -103,10 +103,10 @@ void _glfwPlatformSetTime(double t) |
|
|
|
|
{ |
|
|
|
|
__int64 t_64; |
|
|
|
|
|
|
|
|
|
if (_glfwLibrary.Win32.timer.HasPerformanceCounter) |
|
|
|
|
if (_glfwLibrary.Win32.timer.hasPerformanceCounter) |
|
|
|
|
{ |
|
|
|
|
QueryPerformanceCounter((LARGE_INTEGER*) &t_64); |
|
|
|
|
_glfwLibrary.Win32.timer.t0_64 = t_64 - (__int64) (t / _glfwLibrary.Win32.timer.Resolution); |
|
|
|
|
_glfwLibrary.Win32.timer.t0_64 = t_64 - (__int64) (t / _glfwLibrary.Win32.timer.resolution); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
_glfwLibrary.Win32.timer.t0_32 = _glfw_timeGetTime() - (int)(t * 1000.0); |
|
|
|
|