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 --- src/tool_util.c | 11 ++--------- src/tool_util.h | 2 -- 2 files changed, 2 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/tool_util.c b/src/tool_util.c index 15b91d303..dab60f0bd 100644 --- a/src/tool_util.c +++ b/src/tool_util.c @@ -121,8 +121,8 @@ struct timeval tool_tvnow(void) */ long tool_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; } /* @@ -137,10 +137,3 @@ double tool_tvdiff_secs(struct timeval newer, struct timeval older) (double)(newer.tv_usec-older.tv_usec)/1000000.0; return (double)(newer.tv_usec-older.tv_usec)/1000000.0; } - -/* return the number of seconds in the given input timeval struct */ -long tool_tvlong(struct timeval t1) -{ - return t1.tv_sec; -} - diff --git a/src/tool_util.h b/src/tool_util.h index 8f72d6261..d5b3898ff 100644 --- a/src/tool_util.h +++ b/src/tool_util.h @@ -45,12 +45,10 @@ long tool_tvlong(struct timeval t1); #undef tvnow #undef tvdiff #undef tvdiff_secs -#undef tvlong #define tvnow() tool_tvnow() #define tvdiff(a,b) tool_tvdiff((a), (b)) #define tvdiff_secs(a,b) tool_tvdiff_secs((a), (b)) -#define tvlong(a) tool_tvlong((a)) #endif /* HEADER_CURL_TOOL_UTIL_H */ -- cgit v1.2.3