fix unused timediff warning with clang-cl

```
C:/projects/curl/tests/server/util.c(463,13): error : unused function 'timediff' [-Werror,-Wunused-function]
```
https://ci.appveyor.com/project/curlorg/curl/builds/51606010/job/p1e4tmsahj0p043r#L208
This commit is contained in:
Viktor Szakats 2025-02-28 17:14:32 +01:00
parent aefa84ce58
commit 6b48d5938c
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201

View File

@ -65,8 +65,6 @@
const char *serverlogfile = "log/server_default.log";
static long timediff(struct timeval newer, struct timeval older);
static struct timeval tvnow(void);
/* This function returns a pointer to STATIC memory. It converts the given
@ -224,6 +222,19 @@ FILE *test2fopen(long testno, const char *logdir2)
return stream;
}
#if !defined(MSDOS) && !defined(USE_WINSOCK)
static long timediff(struct timeval newer, struct timeval older)
{
timediff_t diff = newer.tv_sec-older.tv_sec;
if(diff >= (LONG_MAX/1000))
return LONG_MAX;
else if(diff <= (LONG_MIN/1000))
return LONG_MIN;
return (long)(newer.tv_sec-older.tv_sec)*1000+
(long)(newer.tv_usec-older.tv_usec)/1000;
}
#endif
/*
* Portable function used for waiting a specific amount of ms.
* Waiting indefinitely with this function is not allowed, a
@ -460,17 +471,6 @@ static struct timeval tvnow(void)
#endif
static long timediff(struct timeval newer, struct timeval older)
{
timediff_t diff = newer.tv_sec-older.tv_sec;
if(diff >= (LONG_MAX/1000))
return LONG_MAX;
else if(diff <= (LONG_MIN/1000))
return LONG_MIN;
return (long)(newer.tv_sec-older.tv_sec)*1000+
(long)(newer.tv_usec-older.tv_usec)/1000;
}
/* vars used to keep around previous signal handlers */
typedef void (*SIGHANDLER_T)(int);