summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-09-11 13:58:49 +0900
committerRyo Nakamura <upa@haeena.net>2023-11-01 19:54:18 +0900
commitd7365683a9b7f30acf9aa8de0a0e5306c7095365 (patch)
tree6dee4da4678dcf84e4a08479c9e66a25ed1fff66 /src/main.c
parent53a560b130163568149d72baf0228ead28365cec (diff)
print 1st decimal point in the progress bar
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 8a229dd..f57ca97 100644
--- a/src/main.c
+++ b/src/main.c
@@ -492,7 +492,7 @@ void print_progress(struct timeval *b, struct timeval *a,
char *byte_units[] = { "B ", "KB", "MB", "GB", "TB", "PB" };
char suffix[128];
int bps_u, byte_tu, byte_du;
- size_t total_round, done_round;
+ double total_round, done_round;
int percent;
double bps;
@@ -515,11 +515,11 @@ void print_progress(struct timeval *b, struct timeval *a,
percent = floor(((double)(done) / (double)total) * 100);
done_round = done;
- for (byte_du = 0; done_round > 1000 && byte_du < array_size(byte_units) - 1;
+ for (byte_du = 0; done_round > 1024 && byte_du < array_size(byte_units) - 1;
byte_du++)
done_round /= 1024;
- snprintf(suffix, sizeof(suffix), "%4lu%s/%lu%s %6.1f%s %s",
+ snprintf(suffix, sizeof(suffix), "%4.1lf%s/%.1lf%s %6.1f%s %s",
done_round, byte_units[byte_du], total_round, byte_units[byte_tu],
bps, bps_units[bps_u],
calculate_eta(total - done, done - last, b, a, final));