]> granicus.if.org Git - curl/commitdiff
curl: --progress-bar max update frequency now at 5Hz
authorDaniel Stenberg <daniel@haxx.se>
Wed, 31 Jul 2013 07:06:15 +0000 (09:06 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 31 Jul 2013 11:41:00 +0000 (13:41 +0200)
src/Makefile.inc
src/tool_cb_prg.c
src/tool_cb_prg.h

index cd890accc7a1060ae259be217935a583f1546bfa..09bd9e804bc01d50e578dbb58688d781c6476004 100644 (file)
@@ -13,7 +13,8 @@ CURLX_ONES = \
        ../lib/strtoofft.c \
        ../lib/strdup.c \
        ../lib/rawstr.c \
-       ../lib/nonblock.c
+       ../lib/nonblock.c \
+       ../lib/timeval.c
 
 CURL_CFILES = \
        tool_binmode.c \
index 9facd9e7618cec4e5dbb1ffb805691f890bf0cc0..b94442be8de5a6d687ce1ddbbbea2d10910e6225 100644 (file)
@@ -49,12 +49,12 @@ int tool_progress_cb(void *clientp,
   double percent;
   int barwidth;
   int num;
-  time_t now = time(NULL);
+  struct timeval now = curlx_tvnow();
   struct ProgressData *bar = (struct ProgressData *)clientp;
   curl_off_t total;
   curl_off_t point;
 
-  if(bar->prevtime == now) /* wait with update */
+  if(curlx_tvdiff(now, bar->prevtime) < 200) /* allow 5 Hz */
     return 0;
 
   /* expected transfer size */
index ceb85980ca69788f39db1fd76d98a00f2ef8b66e..a20645e86eb7f39d36dd4d7e711c05fa910b9483 100644 (file)
@@ -29,7 +29,7 @@
 struct ProgressData {
   int         calls;
   curl_off_t  prev;
-  time_t      prevtime;
+  struct timeval prevtime;
   int         width;
   FILE       *out;  /* where to write everything to */
   curl_off_t  initial_size;