1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

progress: fix "time spent", broke in adef394ac

This commit is contained in:
Daniel Stenberg 2017-06-24 01:18:21 +02:00
parent 924cd3e25b
commit 64ed44a815

View File

@ -361,18 +361,18 @@ int Curl_pgrsUpdate(struct connectdata *conn)
now = Curl_tvnow(); /* what time is it */ now = Curl_tvnow(); /* what time is it */
/* The time spent so far (from the start) */ /* The time spent so far (from the start) */
data->progress.timespent = Curl_tvdiff_us(now, data->progress.start); data->progress.timespent = Curl_tvdiff(now, data->progress.start);
timespent = (curl_off_t)data->progress.timespent; timespent = (curl_off_t)data->progress.timespent/1000; /* integer seconds */
/* The average download speed this far */ /* The average download speed this far */
data->progress.dlspeed = (curl_off_t) data->progress.dlspeed = (curl_off_t)
(data->progress.downloaded/ (data->progress.downloaded/
(data->progress.timespent>0?data->progress.timespent:1)); (timespent>0?timespent:1));
/* The average upload speed this far */ /* The average upload speed this far */
data->progress.ulspeed = (curl_off_t) data->progress.ulspeed = (curl_off_t)
(data->progress.uploaded/ (data->progress.uploaded/
(data->progress.timespent>0?data->progress.timespent:1)); (timespent>0?timespent:1));
/* Calculations done at most once a second, unless end is reached */ /* Calculations done at most once a second, unless end is reached */
if(data->progress.lastshow != now.tv_sec) { if(data->progress.lastshow != now.tv_sec) {