summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/timeval.c
diff options
context:
space:
mode:
authordartraiden <wowemuh@gmail.com>2023-10-11 18:36:33 +0300
committerdartraiden <wowemuh@gmail.com>2023-10-11 18:38:34 +0300
commitb7dfc6fda6f6b461f45a2ce457911bf128160208 (patch)
tree795d58d5d6d83c483022c3e14640f5999d0c0623 /libs/libcurl/src/timeval.c
parentf40b2ce583f05b0756c4552f2e46535bea2c0c39 (diff)
libcurl: update to 8.4.0
Diffstat (limited to 'libs/libcurl/src/timeval.c')
-rw-r--r--libs/libcurl/src/timeval.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/libcurl/src/timeval.c b/libs/libcurl/src/timeval.c
index 8f081be9c2..8989c5b8b9 100644
--- a/libs/libcurl/src/timeval.c
+++ b/libs/libcurl/src/timeval.c
@@ -210,6 +210,20 @@ timediff_t Curl_timediff(struct curltime newer, struct curltime older)
}
/*
+ * Returns: time difference in number of milliseconds, rounded up.
+ * For too large diffs it returns max value.
+ */
+timediff_t Curl_timediff_ceil(struct curltime newer, struct curltime older)
+{
+ timediff_t diff = (timediff_t)newer.tv_sec-older.tv_sec;
+ if(diff >= (TIMEDIFF_T_MAX/1000))
+ return TIMEDIFF_T_MAX;
+ else if(diff <= (TIMEDIFF_T_MIN/1000))
+ return TIMEDIFF_T_MIN;
+ return diff * 1000 + (newer.tv_usec - older.tv_usec + 999)/1000;
+}
+
+/*
* Returns: time difference in number of microseconds. For too large diffs it
* returns max value.
*/