summaryrefslogtreecommitdiff
path: root/lib/timeval.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-06-07 13:16:56 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-06-14 15:46:39 +0100
commitadef394ac5390e80227c949cbea4a7c22a114677 (patch)
tree182b36490d31233aff436b329d3d33ae13f9d4bf /lib/timeval.h
parent11c2fb04467520b82f2251629710e6d4a0798700 (diff)
downloadcurl-adef394ac5390e80227c949cbea4a7c22a114677.tar.gz
timers: store internal time stamps as time_t instead of doubles
This gives us accurate precision and it allows us to avoid storing "no time" for systems with too low timer resolution as we then bump the time up to 1 microsecond. Should fix test 573 on windows. Remove the now unused curlx_tvdiff_secs() function. Maintains the external getinfo() API with using doubles. Fixes #1531
Diffstat (limited to 'lib/timeval.h')
-rw-r--r--lib/timeval.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/timeval.h b/lib/timeval.h
index 33969354d..9217018a8 100644
--- a/lib/timeval.h
+++ b/lib/timeval.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, 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
@@ -40,17 +40,17 @@ struct timeval curlx_tvnow(void);
time_t curlx_tvdiff(struct timeval t1, struct timeval t2);
/*
- * Same as curlx_tvdiff but with full usec resolution.
+ * Make sure that the first argument (t1) is the more recent time and t2 is
+ * the older time, as otherwise you get a weird negative time-diff back...
*
- * Returns: the time difference in seconds with subsecond resolution.
+ * Returns: the time difference in number of microseconds.
*/
-double curlx_tvdiff_secs(struct timeval t1, struct timeval t2);
+time_t Curl_tvdiff_us(struct timeval newer, struct timeval older);
/* These two defines below exist to provide the older API for library
internals only. */
#define Curl_tvnow() curlx_tvnow()
#define Curl_tvdiff(x,y) curlx_tvdiff(x,y)
-#define Curl_tvdiff_secs(x,y) curlx_tvdiff_secs(x,y)
#endif /* HEADER_CURL_TIMEVAL_H */