On Tue, Dec 1, 2026 at 12:19 AM ivan.apache.org via commits <[email protected]> wrote: > > Author: ivan > Date: Mon Nov 30 23:18:59 2026 > New Revision: 1941007 > > Log: > * time/win32/time.c > (apr_time_monotonic): Handle error from QueryPerformanceCounter() and > fallback to GetTickCount64(). It's very unlikely since documentation > states that QueryPerformanceCounter() never fails on since Windows XP, > but it's better to handle worst case anyway. > > Modified: > apr/apr/trunk/time/win32/time.c > > Modified: apr/apr/trunk/time/win32/time.c > ============================================================================== > --- apr/apr/trunk/time/win32/time.c Mon Nov 30 23:16:20 2026 > (r1941006) > +++ apr/apr/trunk/time/win32/time.c Mon Nov 30 23:18:59 2026 > (r1941007) > @@ -116,18 +116,17 @@ APR_DECLARE(apr_interval_time_t) apr_tim > { > LARGE_INTEGER now; > > - if (!qpc_freq) { > + if (qpc_freq && QueryPerformanceCounter(&now)) { > + /* Whole seconds, then the remainder's microseconds, so that the > + * multiplication can't overflow > + */ > + return apr_time_make(now.QuadPart / qpc_freq, > + now.QuadPart % qpc_freq * APR_USEC_PER_SEC / > qpc_freq); > + } > + else { > + /* Fallback to GetTickCount64() otherwise. */ > return apr_time_from_msec(GetTickCount64()); > }
QueryPerformanceCounter() is already tested in apr__time_init(), why would it fail here? Adding the check here at runtime, besides having two calls potentially, could break monotony if QueryPerformanceCounter() switches from working to not working as it pleases? Cheers; Yann.
