1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

curl: --progress-bar max update frequency now at 5Hz

This commit is contained in:
Daniel Stenberg 2013-07-31 09:06:15 +02:00
parent 1691a31cab
commit 5af2bfb955
3 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,8 @@ CURLX_ONES = \
../lib/strtoofft.c \ ../lib/strtoofft.c \
../lib/strdup.c \ ../lib/strdup.c \
../lib/rawstr.c \ ../lib/rawstr.c \
../lib/nonblock.c ../lib/nonblock.c \
../lib/timeval.c
CURL_CFILES = \ CURL_CFILES = \
tool_binmode.c \ tool_binmode.c \

View File

@ -49,12 +49,12 @@ int tool_progress_cb(void *clientp,
double percent; double percent;
int barwidth; int barwidth;
int num; int num;
time_t now = time(NULL); struct timeval now = curlx_tvnow();
struct ProgressData *bar = (struct ProgressData *)clientp; struct ProgressData *bar = (struct ProgressData *)clientp;
curl_off_t total; curl_off_t total;
curl_off_t point; curl_off_t point;
if(bar->prevtime == now) /* wait with update */ if(curlx_tvdiff(now, bar->prevtime) < 200) /* allow 5 Hz */
return 0; return 0;
/* expected transfer size */ /* expected transfer size */

View File

@ -29,7 +29,7 @@
struct ProgressData { struct ProgressData {
int calls; int calls;
curl_off_t prev; curl_off_t prev;
time_t prevtime; struct timeval prevtime;
int width; int width;
FILE *out; /* where to write everything to */ FILE *out; /* where to write everything to */
curl_off_t initial_size; curl_off_t initial_size;