3535
3636# define WIN32_LEAN_AND_MEAN
3737
38- static LARGE_INTEGER _timer_freq ;
38+ static uint64_t _timer_freq = { 0 } ;
3939
4040#elif PHP_HRTIME_PLATFORM_APPLE
4141
@@ -61,11 +61,11 @@ static int _timer_init()
6161{/*{{{*/
6262#if PHP_HRTIME_PLATFORM_WINDOWS
6363
64- _timer_freq .LowPart = 0 ;
65- _timer_freq .HighPart = 0 ;
66- if (!QueryPerformanceFrequency (& _timer_freq ) || 0 == _timer_freq .QuadPart ) {
64+ LARGE_INTEGER tf = {0 };
65+ if (!QueryPerformanceFrequency (& tf ) || 0 == tf .QuadPart ) {
6766 return -1 ;
6867 }
68+ _timer_freq = (uint64_t )tf .QuadPart ;
6969
7070#elif PHP_HRTIME_PLATFORM_APPLE
7171
@@ -114,11 +114,13 @@ PHP_MINIT_FUNCTION(hrtime)
114114static zend_always_inline php_hrtime_t _timer_current (void )
115115{/*{{{*/
116116#if PHP_HRTIME_PLATFORM_WINDOWS
117- LARGE_INTEGER lt ;
117+ php_hrtime_t ret ;
118+ LARGE_INTEGER lt = {0 };
118119 QueryPerformanceCounter (& lt );
119- lt .QuadPart *= NANO_IN_SEC ;
120- lt .QuadPart /= _timer_freq .QuadPart ;
121- return (php_hrtime_t )lt .QuadPart ;
120+ ret = (php_hrtime_t )lt .QuadPart ;
121+ ret *= (php_hrtime_t )NANO_IN_SEC ;
122+ ret /= _timer_freq ;
123+ return ret ;
122124#elif PHP_HRTIME_PLATFORM_APPLE
123125 return (php_hrtime_t )mach_absolute_time () * _timerlib_info .numer / _timerlib_info .denom ;
124126#elif PHP_HRTIME_PLATFORM_POSIX
0 commit comments