timeval: rename timer frequency variable

It's no longer a global variable.

Follow-up to 1027d07704 #22346

Closes #22347
This commit is contained in:
Viktor Szakats 2026-07-18 03:18:11 +02:00
parent 1027d07704
commit 1128177a6f
No known key found for this signature in database

View file

@ -27,24 +27,24 @@
#include "system_win32.h"
static LARGE_INTEGER Curl_freq;
static LARGE_INTEGER s_time_freq;
/* For tool or tests, we must initialize before calling curlx_now().
Providing this function here is wrong. */
void curlx_now_init(void)
{
QueryPerformanceFrequency(&Curl_freq);
QueryPerformanceFrequency(&s_time_freq);
}
/* In case of bug fix this function has a counterpart in tool_util.c */
void curlx_pnow(struct curltime *pnow)
{
LARGE_INTEGER count;
DEBUGASSERT(Curl_freq.QuadPart);
DEBUGASSERT(s_time_freq.QuadPart);
QueryPerformanceCounter(&count);
pnow->tv_sec = (time_t)(count.QuadPart / Curl_freq.QuadPart);
pnow->tv_usec = (int)((count.QuadPart % Curl_freq.QuadPart) * 1000000 /
Curl_freq.QuadPart);
pnow->tv_sec = (time_t)(count.QuadPart / s_time_freq.QuadPart);
pnow->tv_usec = (int)((count.QuadPart % s_time_freq.QuadPart) * 1000000 /
s_time_freq.QuadPart);
}
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC) || \