diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-11-12 22:10:09 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-11-12 22:10:09 +0000 |
commit | 92aedf850e2e81fd0e1e319c6432a07168c0c4b7 (patch) | |
tree | b2a9c3a42083d7fcbb67b0819f0148dad4e8ca0e | |
parent | dd157fc3492507ed23c388dbe42d29cd1c8d1a2b (diff) |
made Curl_tvdiff round the diff better and make the subtraction before
the multiply to not wrap-around
-rw-r--r-- | lib/timeval.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/timeval.c b/lib/timeval.c index f9284349d..cd4461376 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -69,10 +69,10 @@ struct timeval Curl_tvnow (void) * Make sure that the first argument is the more recent time, as otherwise * we'll get a weird negative time-diff back... */ -long Curl_tvdiff (struct timeval t1, struct timeval t2) +long Curl_tvdiff (struct timeval newer, struct timeval older) { - return (t1.tv_sec*1000 + t1.tv_usec/1000)- - (t2.tv_sec*1000 + t2.tv_usec/1000); + return (newer.tv_sec-older.tv_sec)*1000+ + (499+newer.tv_usec-older.tv_usec)/1000; } long Curl_tvlong (struct timeval t1) |