diff options
Diffstat (limited to 'tests/libtest/testutil.c')
-rw-r--r-- | tests/libtest/testutil.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c index b9c43de04..f3ad0ce58 100644 --- a/tests/libtest/testutil.c +++ b/tests/libtest/testutil.c @@ -111,10 +111,11 @@ struct timeval tutil_tvnow(void) */ long tutil_tvdiff(struct timeval newer, struct timeval older) { - return (newer.tv_sec-older.tv_sec)*1000+ - (newer.tv_usec-older.tv_usec)/1000; + return (long)(newer.tv_sec-older.tv_sec)*1000+ + (long)(newer.tv_usec-older.tv_usec)/1000; } + /* * Same as tutil_tvdiff but with full usec resolution. * @@ -125,13 +126,5 @@ double tutil_tvdiff_secs(struct timeval newer, struct timeval older) if(newer.tv_sec != older.tv_sec) return (double)(newer.tv_sec-older.tv_sec)+ (double)(newer.tv_usec-older.tv_usec)/1000000.0; - else - return (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) -{ - return t1.tv_sec; + return (double)(newer.tv_usec-older.tv_usec)/1000000.0; } - |