void _glfwInitTimer( void ) { __int64 freq; // Check if we have a performance counter if( QueryPerformanceFrequency( (LARGE_INTEGER *)&freq ) ) { // Performance counter is available => use it! _glfwLibrary.Timer.HasPerformanceCounter = GL_TRUE; // Counter resolution is 1 / counter frequency _glfwLibrary.Timer.Resolution = 1.0 / (double)freq; // Set start time for timer QueryPerformanceCounter( (LARGE_INTEGER *)&_glfwLibrary.Timer.t0_64 ); } else { // No performace counter available => use the tick counter _glfwLibrary.Timer.HasPerformanceCounter = GL_FALSE; // Counter resolution is 1 ms _glfwLibrary.Timer.Resolution = 0.001; // Set start time for timer _glfwLibrary.Timer.t0_32 = _glfw_timeGetTime(); } }
uint64_t _glfwPlatformGetTimerValue(void) { if (_glfw.win32_time.hasPC) { uint64_t value; QueryPerformanceCounter((LARGE_INTEGER*) &value); return value; } else return (uint64_t) _glfw_timeGetTime(); }
// Return raw time // static unsigned __int64 getRawTime(void) { if (_glfw.win32_time.hasPC) { unsigned __int64 time; QueryPerformanceCounter((LARGE_INTEGER*) &time); return time; } else return (unsigned __int64) _glfw_timeGetTime(); }
void _glfwPlatformSetTime(double t) { __int64 t_64; if (_glfwLibrary.Win32.timer.hasPC) { QueryPerformanceCounter((LARGE_INTEGER*) &t_64); _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); }
double _glfwPlatformGetTime(void) { double t; __int64 t_64; if (_glfwLibrary.Win32.timer.hasPC) { QueryPerformanceCounter((LARGE_INTEGER*) &t_64); t = (double)(t_64 - _glfwLibrary.Win32.timer.t0_64); } else t = (double)(_glfw_timeGetTime() - _glfwLibrary.Win32.timer.t0_32); return t * _glfwLibrary.Win32.timer.resolution; }
void _glfwInitTimer(void) { __int64 freq; if (QueryPerformanceFrequency((LARGE_INTEGER*) &freq)) { _glfwLibrary.Win32.timer.hasPC = GL_TRUE; _glfwLibrary.Win32.timer.resolution = 1.0 / (double) freq; QueryPerformanceCounter((LARGE_INTEGER*) &_glfwLibrary.Win32.timer.t0_64); } else { _glfwLibrary.Win32.timer.hasPC = GL_FALSE; _glfwLibrary.Win32.timer.resolution = 0.001; // winmm resolution is 1 ms _glfwLibrary.Win32.timer.t0_32 = _glfw_timeGetTime(); } }
double _glfwPlatformGetTime( void ) { double t; __int64 t_64; if( _glfwLibrary.Timer.HasPerformanceCounter ) { QueryPerformanceCounter( (LARGE_INTEGER *)&t_64 ); t = (double)(t_64 - _glfwLibrary.Timer.t0_64); } else { t = (double)(_glfw_timeGetTime() - _glfwLibrary.Timer.t0_32); } // Calculate the current time in seconds return t * _glfwLibrary.Timer.Resolution; }