From ae2e23c1b78db157fa06446dbc48befad8cc0e16 Mon Sep 17 00:00:00 2001 From: pdw <> Date: Thu, 10 Oct 2002 09:15:58 +0000 Subject: [PATCH] Minor fix to display of rates. --- ui.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui.c b/ui.c index c65b9f4..11c6f88 100644 --- a/ui.c +++ b/ui.c @@ -61,10 +61,13 @@ int screen_line_compare(void* a, void* b) { } void readable_size(float n, char* buf, int bsize, int ksize, int bytes) { - if(n >= 100000) { + if(n >= ksize * ksize) { snprintf(buf, bsize, " %4.1f%s", n / (ksize * ksize), bytes ? "MB" : "M"); } - else if(n >= 1000) { + if(n >= 100 * ksize) { + snprintf(buf, bsize, " %4.0f%s", n / ksize, bytes ? "KB" : "K" ); + } + else if(n >= ksize) { snprintf(buf, bsize, " %4.1f%s", n / ksize, bytes ? "KB" : "K" ); } else {