1 diff -r -u poldek-0.18.3/vfile/vfile.h poldek-0.18.3-patrys/vfile/vfile.h
2 --- poldek-0.18.3/vfile/vfile.h 2004-03-21 13:58:18.172520008 +0100
3 +++ poldek-0.18.3-patrys/vfile/vfile.h 2004-03-21 13:11:43.209418984 +0100
6 #include <trurl/narray.h>
10 extern int *vfile_verbose;
11 extern const char *vfile_anonftp_passwd;
12 extern void (*vfile_msg_fn)(const char *fmt, ...);
20 void vfile_progress_init(struct vf_progress_bar *bar);
21 diff -r -u poldek-0.18.3/vfile/vfprogress.c poldek-0.18.3-patrys/vfile/vfprogress.c
22 --- poldek-0.18.3/vfile/vfprogress.c 2002-11-11 22:22:10.000000000 +0100
23 +++ poldek-0.18.3-patrys/vfile/vfprogress.c 2004-03-21 13:55:53.242552712 +0100
25 #define VFILE_INTERNAL
28 -#define PROGRESSBAR_WIDTH 50
29 +#define PROGRESSBAR_WIDTH 30
31 void vfile_progress_init(struct vf_progress_bar *bar)
34 char line[256], outline[256], fmt[40];
39 + time_t current_time;
40 + float transfer_rate = 0.0;
43 if (bar->state == VF_PROGRESS_DISABLED)
50 + bar->time_base = time(NULL);
51 bar->state = VF_PROGRESS_RUNNING;
58 - char unit_line[23], amount_str[16], total_str[16];
59 + char unit_line[43], amount_str[16], total_str[16];
63 + current_time = time(NULL);
64 + if (current_time != bar->time_base)
66 + transfer_rate = amount / (current_time - bar->time_base) / 1024.0;
68 + if (transfer_rate > 0)
70 + eta = 0.5 + (total - amount) / (transfer_rate * 1024);
73 nbytes2str(total_str, sizeof(total_str), total);
74 nbytes2str(amount_str, sizeof(amount_str), amount);
77 - nn = n_snprintf(unit_line, sizeof(unit_line), "[%s]", total_str);
78 + nn = n_snprintf(unit_line, sizeof(unit_line), "[%s] [%.1fK/s]",
79 + total_str, transfer_rate);
81 - nn = n_snprintf(unit_line, sizeof(unit_line), "[%s of %s]",
82 - amount_str, total_str);
83 + nn = n_snprintf(unit_line, sizeof(unit_line), "[%s of %s] [%.1fK/s] [%dm%s%ds]",
84 + amount_str, total_str, transfer_rate, (int)eta / 60,
85 + ((int)eta % 60 < 10 ? "0" : ""), (int)eta % 60);
87 unit_n = sizeof(unit_line) - nn - 1;