Switch to unified view
a/src/utils/smallut.cpp | b/src/utils/smallut.cpp | ||
---|---|---|---|
... |
... |
||
592 | string displayableBytes(off_t size) |
592 | string displayableBytes(off_t size) |
593 | { |
593 | { |
594 | char sizebuf[50]; |
594 | char sizebuf[50]; |
595 | const char *unit; |
595 | const char *unit; |
596 | 596 | ||
597 | if (size < 1024) {
|
597 | if (size < 1000) {
|
598 | unit = " B "; |
598 | unit = " B "; |
599 | } else if (size < 1024*1024) {
|
599 | } else if (size < 1E6) {
|
600 | unit = " KB "; |
600 | unit = " KB "; |
601 | size /= 1024;
|
601 | size /= 1000;
|
602 | } else if (size < 1024*1024*1024) {
|
602 | } else if (size < 1E9) {
|
603 | unit = " MB "; |
603 | unit = " MB "; |
604 | size /= (1024*1024); |
604 | size /= (1E6); |
605 | } else { |
605 | } else { |
606 | unit = " GB "; |
606 | unit = " GB "; |
607 | size /= (1024*1024*1024); |
607 | size /= (1E9); |
608 | } |
608 | } |
609 | 609 | ||
610 | sprintf(sizebuf, OFFTPC "%s", size, unit); |
610 | sprintf(sizebuf, OFFTPC "%s", size, unit); |
611 | return string(sizebuf); |
611 | return string(sizebuf); |
612 | } |
612 | } |