summaryrefslogtreecommitdiffstats
path: root/src/Client/SystemCommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client/SystemCommands.cpp')
-rw-r--r--src/Client/SystemCommands.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Client/SystemCommands.cpp b/src/Client/SystemCommands.cpp
index c26be54..1cc9bc4 100644
--- a/src/Client/SystemCommands.cpp
+++ b/src/Client/SystemCommands.cpp
@@ -30,7 +30,7 @@
#include <Common/Requests/StatusRequest.h>
#include <iostream>
-
+#include <algorithm>
namespace Mad {
namespace Client {
@@ -74,9 +74,12 @@ void SystemCommands::printFSInfo(boost::shared_ptr<const Common::XmlPacket> &pac
nameString += "\n\t";
nameString.resize(nameString.length() + 32, ' ');
}
+
+ float percent = 100*used/(used+available);
+ if(percent > 100) percent = 100;
std::printf("\t%s%.*f%s", nameString.c_str(), (used < 10) ? 2 : 1, used, (usedUnit == totalUnit) ? "" : (" " + units[usedUnit]).c_str());
- std::printf("/%.*f %s (%.1f%%)\n", (total < 10) ? 2 : 1, total, units[totalUnit].c_str(), std::min(100*used/(used+available), 100.0f));
+ std::printf("/%.*f %s (%.1f%%)\n", (total < 10) ? 2 : 1, total, units[totalUnit].c_str(), percent);
}
}