File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5858static char * process_title ;
5959static CRITICAL_SECTION process_title_lock ;
6060
61- /* Interval (in seconds) of the high-resolution clock. */
62- static double hrtime_interval_ = 0 ;
61+ /* Interval of the high-resolution clock. */
62+ static uint64_t hrtime_interval_ = 0 ;
6363
6464
6565/*
@@ -71,11 +71,9 @@ void uv__util_init() {
7171 /* Initialize process title access mutex. */
7272 InitializeCriticalSection (& process_title_lock );
7373
74- /* Retrieve high-resolution timer frequency
75- * and precompute its reciprocal.
76- */
74+ /* Retrieve high-resolution timer frequency */
7775 if (QueryPerformanceFrequency (& perf_frequency )) {
78- hrtime_interval_ = 1.0 / perf_frequency .QuadPart ;
76+ hrtime_interval_ = perf_frequency .QuadPart ;
7977 } else {
8078 hrtime_interval_ = 0 ;
8179 }
@@ -484,7 +482,7 @@ uint64_t uv__hrtime(double scale) {
484482 * performance counter interval, integer math could cause this computation
485483 * to overflow. Therefore we resort to floating point math.
486484 */
487- return (uint64_t ) ((double ) counter .QuadPart * hrtime_interval_ * scale );
485+ return (uint64_t ) ((counter .QuadPart / hrtime_interval_ ) * scale );
488486}
489487
490488
You can’t perform that action at this time.
0 commit comments