From de4de4e3c7c4690393de384f81b6c094d9f5d553 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 11 Nov 2016 10:19:22 +0100 Subject: timeval: prefer time_t to hold seconds instead of long ... as long is still 32bit on modern 64bit windows machines, while time_t is generally 64bit. --- lib/timeval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/timeval.c') diff --git a/lib/timeval.c b/lib/timeval.c index 629f1c8f0..f3b207a37 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -116,7 +116,7 @@ struct timeval curlx_tvnow(void) * Returns: the time difference in number of milliseconds. For large diffs it * returns 0x7fffffff on 32bit time_t systems. */ -long curlx_tvdiff(struct timeval newer, struct timeval older) +time_t curlx_tvdiff(struct timeval newer, struct timeval older) { #if SIZEOF_TIME_T < 8 /* for 32bit time_t systems, add a precaution to avoid overflow for really @@ -126,7 +126,7 @@ long curlx_tvdiff(struct timeval newer, struct timeval older) return 0x7fffffff; #endif return (newer.tv_sec-older.tv_sec)*1000+ - (long)(newer.tv_usec-older.tv_usec)/1000; + (time_t)(newer.tv_usec-older.tv_usec)/1000; } /* @@ -144,7 +144,7 @@ double curlx_tvdiff_secs(struct timeval newer, struct timeval older) } /* return the number of seconds in the given input timeval struct */ -long Curl_tvlong(struct timeval t1) +time_t Curl_tvlong(struct timeval t1) { return t1.tv_sec; } -- cgit v1.2.3