curltime: use libcurl time functions in src and tests/server

The curl tool and tests/server used 2 parallel implementations
of libcurl's `Curl_now()` and `Curl_timediff()` functions.

Make them use the libcurl one.

Closes #16653
This commit is contained in:
Viktor Szakats 2025-03-09 13:14:31 +01:00
parent b1faac8039
commit 436d4a360a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
20 changed files with 129 additions and 292 deletions

View file

@ -28,6 +28,18 @@
#include "timediff.h"
#ifndef BUILDING_LIBCURL
/* this renames the functions so that the tool code can use the same code
without getting symbol collisions */
#define Curl_now curlx_now
#define Curl_timediff(a,b) curlx_timediff(a,b)
#define Curl_timediff_ceil(a,b) curlx_timediff_ceil(a,b)
#define Curl_timediff_us(a,b) curlx_timediff_us(a,b)
/* For tool or tests, we must initialize before calling Curl_now() */
void curlx_now_init(void);
#endif
struct curltime {
time_t tv_sec; /* seconds */
int tv_usec; /* microseconds */