summaryrefslogtreecommitdiff
path: root/tests/libtest/testutil.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-02-20 01:09:38 +0000
committerYang Tse <yangsita@gmail.com>2007-02-20 01:09:38 +0000
commitda8c666e4fae66d58ce8bfb6cf48f91ec47f38c6 (patch)
tree56b0487deaecef13493b2780dec4eb7d3d7f05dc /tests/libtest/testutil.c
parentc11681becdcf451c71342742145827ad347e002a (diff)
downloadcurl-da8c666e4fae66d58ce8bfb6cf48f91ec47f38c6.tar.gz
add tutil_tvdiff_secs() for completeness
Diffstat (limited to 'tests/libtest/testutil.c')
-rw-r--r--tests/libtest/testutil.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c
index 6acd5a71b..dc0211026 100644
--- a/tests/libtest/testutil.c
+++ b/tests/libtest/testutil.c
@@ -98,6 +98,17 @@ long tutil_tvdiff(struct timeval newer, struct timeval older)
(newer.tv_usec-older.tv_usec)/1000;
}
+/*
+ * Same as tutil_tvdiff but with full usec resolution.
+ *
+ * Returns: the time difference in seconds with subsecond resolution.
+ */
+double tutil_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 tutil_tvlong(struct timeval t1)
{