summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-08-09 13:55:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-08-09 14:11:42 +0200
commit374a536f4e2cc561b768a8be463e7194a41bb952 (patch)
tree39eea19979c1f3ab936c96f16eb3210ce9ce02fa
parent9f6a429c3f7908c7582f7f2d834752a54b74624a (diff)
refresh progress more often
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--fb-helper.c.in8
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 */