aboutsummaryrefslogtreecommitdiff
path: root/lib/timeval.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-04-09 09:36:31 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-04-09 09:36:31 +0000
commit2fd463e979ca57c07be4c54e945c33de8651c17c (patch)
treefabfe5f019682c002eb3d83d3df50af9ffbe7c5c /lib/timeval.c
parentde8660a96a8dca55f2a8c194a997fe50bba5864b (diff)
Dirk Manske increased the resolution for what the CURLINFO_*_TIME return.
Diffstat (limited to 'lib/timeval.c')
-rw-r--r--lib/timeval.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/timeval.c b/lib/timeval.c
index 20ac6ea96..11f3d7a06 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -98,6 +98,17 @@ long curlx_tvdiff(struct timeval newer, struct timeval older)
(newer.tv_usec-older.tv_usec)/1000;
}
+/*
+ * Same as curlx_tvdiff but with full usec resolution.
+ *
+ * Returns: the time difference in seconds with subsecond resolution.
+ */
+double curlx_tvdiff_secs(struct timeval newer, struct timeval older)
+{
+ return (double)(newer.tv_sec-older.tv_sec)+
+ (double)(newer.tv_usec-older.tv_usec)/1000000.0;
+}
+
/* return the number of seconds in the given input timeval struct */
long Curl_tvlong(struct timeval t1)
{