diff --git a/progress.c b/progress.c
index 621c34edc2a3a6a9bceb0f708ed5b0df05145fb5..3971f49f4ddaa774806bd1717379a1edd22ba17c 100644 (file)
--- a/progress.c
+++ b/progress.c
/*
* Simple text-based progress display module for GIT
*
/*
* Simple text-based progress display module for GIT
*
- * Copyright (c) 2007 by Nicolas Pitre <nico@cam.org>
+ * Copyright (c) 2007 by Nicolas Pitre <nico@fluxnic.net>
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
*
* This code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
} else {
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
}
} else {
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
}
- if (rate)
+
+ if (rate > 1 << 10) {
+ int x = rate + 5; /* for rounding */
+ snprintf(tp->display + sizeof(tp->display) - l, l,
+ " | %u.%2.2u MiB/s",
+ x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
+ } else if (rate)
snprintf(tp->display + sizeof(tp->display) - l, l,
" | %u KiB/s", rate);
}
snprintf(tp->display + sizeof(tp->display) - l, l,
" | %u KiB/s", rate);
}