mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:43:31 +03:00
timediff: return timediff_t from the time diff functions
... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
This commit is contained in:
parent
016c6a6abb
commit
b9d25f9a6b
22 changed files with 214 additions and 110 deletions
|
|
@ -51,7 +51,7 @@
|
|||
#include "warnless.h"
|
||||
|
||||
/* Convenience local macros */
|
||||
#define ELAPSED_MS() (int)curlx_tvdiff(curlx_tvnow(), initial_tv)
|
||||
#define ELAPSED_MS() (int)Curl_timediff(Curl_tvnow(), initial_tv)
|
||||
|
||||
int Curl_ack_eintr = 0;
|
||||
#define ERROR_NOT_EINTR(error) (Curl_ack_eintr || error != EINTR)
|
||||
|
|
@ -96,7 +96,7 @@ int Curl_wait_ms(int timeout_ms)
|
|||
Sleep(timeout_ms);
|
||||
#else
|
||||
pending_ms = timeout_ms;
|
||||
initial_tv = curlx_tvnow();
|
||||
initial_tv = Curl_tvnow();
|
||||
do {
|
||||
#if defined(HAVE_POLL_FINE)
|
||||
r = poll(NULL, 0, pending_ms);
|
||||
|
|
@ -184,7 +184,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
|
|||
|
||||
if(timeout_ms > 0) {
|
||||
pending_ms = (int)timeout_ms;
|
||||
initial_tv = curlx_tvnow();
|
||||
initial_tv = Curl_tvnow();
|
||||
}
|
||||
|
||||
#ifdef HAVE_POLL_FINE
|
||||
|
|
@ -425,7 +425,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
|
|||
|
||||
if(timeout_ms > 0) {
|
||||
pending_ms = timeout_ms;
|
||||
initial_tv = curlx_tvnow();
|
||||
initial_tv = Curl_tvnow();
|
||||
}
|
||||
|
||||
#ifdef HAVE_POLL_FINE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue