diff options
author | Florian Pritz <bluewind@xinu.at> | 2011-08-09 13:55:49 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2011-08-09 14:11:42 +0200 |
commit | 374a536f4e2cc561b768a8be463e7194a41bb952 (patch) | |
tree | 39eea19979c1f3ab936c96f16eb3210ce9ce02fa /fb-helper.c.in | |
parent | 9f6a429c3f7908c7582f7f2d834752a54b74624a (diff) |
refresh progress more often
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb-helper.c.in')
-rw-r--r-- | fb-helper.c.in | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fb-helper.c.in b/fb-helper.c.in index 860a5e7..bc5a1b7 100644 --- a/fb-helper.c.in +++ b/fb-helper.c.in @@ -105,16 +105,16 @@ int progress_callback(void *cb_data, gettimeofday(&now, NULL); - /* only refresh once a second */ - if (data->last.tv_sec == now.tv_sec) - return 0; - /* calculate time between this and the last call in seconds */ timeSpent = (double)(now.tv_sec - data->last.tv_sec) + (double)(now.tv_usec - data->last.tv_usec) / 1000000.0; format_bytes((ulnow - data->ullast) / timeSpent, (char *)&speed); + /* don't refresh too often, catch if time went backwards */ + if (timeSpent < 0.2 && timeSpent > -1.0) + return 0; + format_bytes(ulnow, (char *)&total); /* print the progress */ |