From 8ab22a74533acee61af31c48e75269822f408cb4 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Sat, 20 May 2017 19:39:51 +0200 Subject: time: fix type conversions and compiler warnings Fix bugs and compiler warnings on systems with 32-bit long and 64-bit time_t. Reviewed-by: Daniel Stenberg Closes #1499 --- tests/libtest/lib1507.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'tests/libtest/lib1507.c') diff --git a/tests/libtest/lib1507.c b/tests/libtest/lib1507.c index 7ab305711..cd8500195 100644 --- a/tests/libtest/lib1507.c +++ b/tests/libtest/lib1507.c @@ -44,23 +44,6 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) return CURL_READFUNC_ABORT; } -static struct timeval tvnow(void) -{ - /* - ** time() returns the value of time in seconds since the Epoch. - */ - struct timeval now; - now.tv_sec = (long)time(NULL); - now.tv_usec = 0; - return now; -} - -static long tvdiff(struct timeval newer, struct timeval older) -{ - return (newer.tv_sec-older.tv_sec)*1000+ - (newer.tv_usec-older.tv_usec)/1000; -} - int test(char *URL) { int res = 0; @@ -93,7 +76,7 @@ int test(char *URL) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); multi_add_handle(mcurl, curl); - mp_start = tvnow(); + mp_start = tutil_tvnow(); /* we start some action by calling perform right away */ curl_multi_perform(mcurl, &still_running); @@ -137,7 +120,7 @@ int test(char *URL) rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { + if(tutil_tvdiff(tutil_tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); break; -- cgit v1.2.3