diff options
author | Ryo Nakamura <upa@haeena.net> | 2023-09-11 13:58:49 +0900 |
---|---|---|
committer | Ryo Nakamura <upa@haeena.net> | 2023-11-01 19:54:18 +0900 |
commit | d7365683a9b7f30acf9aa8de0a0e5306c7095365 (patch) | |
tree | 6dee4da4678dcf84e4a08479c9e66a25ed1fff66 /src/main.c | |
parent | 53a560b130163568149d72baf0228ead28365cec (diff) |
print 1st decimal point in the progress bar
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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)); |