diff options
author | Michael Kaufmann <mail@michael-kaufmann.ch> | 2017-05-20 19:39:51 +0200 |
---|---|---|
committer | Michael Kaufmann <mail@michael-kaufmann.ch> | 2017-05-24 22:56:22 +0200 |
commit | 8ab22a74533acee61af31c48e75269822f408cb4 (patch) | |
tree | 24025f8450cf3b72eb5bf9316c1212b0a571363c /lib/easy.c | |
parent | b4d87f54d60711e936fefae388d741b281eecdf0 (diff) |
time: fix type conversions and compiler warnings
Fix bugs and compiler warnings on systems with 32-bit long and
64-bit time_t.
Reviewed-by: Daniel Stenberg
Closes #1499
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/easy.c b/lib/easy.c index 46c0a9911..2b1ce9e8a 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -615,12 +615,18 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev) } } - if(!ev->msbump) + if(!ev->msbump) { /* If nothing updated the timeout, we decrease it by the spent time. * If it was updated, it has the new timeout time stored already. */ - ev->ms += (long)curlx_tvdiff(after, before); - + time_t timediff = curlx_tvdiff(after, before); + if(timediff > 0) { + if(timediff > ev->ms) + ev->ms = 0; + else + ev->ms -= (long)timediff; + } + } } else return CURLE_RECV_ERROR; |