server: sync timediff_t type across modules
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:
parent
2c7f785b94
commit
e545a06c30
@ -54,6 +54,7 @@
|
|||||||
#include "getpart.h"
|
#include "getpart.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "timeval.h"
|
#include "timeval.h"
|
||||||
|
#include "timediff.h"
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
#undef EINTR
|
#undef EINTR
|
||||||
@ -221,6 +222,19 @@ FILE *test2fopen(long testno, const char *logdir2)
|
|||||||
return stream;
|
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.
|
* Portable function used for waiting a specific amount of ms.
|
||||||
* Waiting indefinitely with this function is not allowed, a
|
* Waiting indefinitely with this function is not allowed, a
|
||||||
@ -457,17 +471,6 @@ static struct timeval tvnow(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 */
|
/* vars used to keep around previous signal handlers */
|
||||||
|
|
||||||
typedef void (*SIGHANDLER_T)(int);
|
typedef void (*SIGHANDLER_T)(int);
|
||||||
|
|||||||
@ -37,7 +37,6 @@ enum {
|
|||||||
|
|
||||||
char *data_to_hex(char *data, size_t len);
|
char *data_to_hex(char *data, size_t len);
|
||||||
void logmsg(const char *msg, ...) CURL_PRINTF(1, 2);
|
void logmsg(const char *msg, ...) CURL_PRINTF(1, 2);
|
||||||
long timediff(struct timeval newer, struct timeval older);
|
|
||||||
|
|
||||||
#define SERVERLOGS_LOCKDIR "lock" /* within logdir */
|
#define SERVERLOGS_LOCKDIR "lock" /* within logdir */
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user