summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-01-08 17:34:45 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-01-08 17:34:45 +0100
commitec7aa29253246f1d3ecad760bf4288c8158b8041 (patch)
tree2144644f452736bed0cb7e9fdce8642d7728ce16
parent114a02c75b702e98abf6328271bc76863c67b931 (diff)
downloadcurl-bagder/timediff-unsigned-time_t.tar.gz
timediff: fix math for unsigned time_tbagder/timediff-unsigned-time_t
Bug: https://curl.haxx.se/mail/lib-2018-12/0088.html
-rw-r--r--lib/timeval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/timeval.c b/lib/timeval.c
index 2d7c782fa..f1cbfe677 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -187,7 +187,7 @@ struct curltime Curl_now(void)
*/
timediff_t Curl_timediff(struct curltime newer, struct curltime older)
{
- timediff_t diff = newer.tv_sec-older.tv_sec;
+ timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
if(diff >= (TIME_MAX/1000))
return TIME_MAX;
else if(diff <= (TIME_MIN/1000))
@@ -201,7 +201,7 @@ timediff_t Curl_timediff(struct curltime newer, struct curltime older)
*/
timediff_t Curl_timediff_us(struct curltime newer, struct curltime older)
{
- timediff_t diff = newer.tv_sec-older.tv_sec;
+ timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
if(diff >= (TIME_MAX/1000000))
return TIME_MAX;
else if(diff <= (TIME_MIN/1000000))