]> granicus.if.org Git - curl/commitdiff
progress: fix "time spent", broke in adef394ac
authorDaniel Stenberg <daniel@haxx.se>
Fri, 23 Jun 2017 23:18:21 +0000 (01:18 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 23 Jun 2017 23:18:21 +0000 (01:18 +0200)
lib/progress.c

index ccabe3c5d68d66f97199b218172346b2c5da2e9c..dce756b7bad19463b88d2ce6d4f3c328fe0a9315 100644 (file)
@@ -361,18 +361,18 @@ int Curl_pgrsUpdate(struct connectdata *conn)
   now = Curl_tvnow(); /* what time is it */
 
   /* The time spent so far (from the start) */
-  data->progress.timespent = Curl_tvdiff_us(now, data->progress.start);
-  timespent = (curl_off_t)data->progress.timespent;
+  data->progress.timespent = Curl_tvdiff(now, data->progress.start);
+  timespent = (curl_off_t)data->progress.timespent/1000; /* integer seconds */
 
   /* The average download speed this far */
   data->progress.dlspeed = (curl_off_t)
     (data->progress.downloaded/
-     (data->progress.timespent>0?data->progress.timespent:1));
+     (timespent>0?timespent:1));
 
   /* The average upload speed this far */
   data->progress.ulspeed = (curl_off_t)
     (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 */
   if(data->progress.lastshow != now.tv_sec) {