summaryrefslogtreecommitdiffstats
path: root/src/Client/SystemCommands.cpp
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-08-18 15:58:17 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-08-18 15:58:17 +0200
commitdb5ad2e09a6b38e841463dbe7eb076492b62c948 (patch)
tree5907f6416e35cbd25432a5f1f6dc9664d36aa73c /src/Client/SystemCommands.cpp
parent5da7b0847bac2a5abec95b9ac1701b74baae8964 (diff)
downloadmad-db5ad2e09a6b38e841463dbe7eb076492b62c948.tar
mad-db5ad2e09a6b38e841463dbe7eb076492b62c948.zip
Mad funktioniert jetzt unter Windows
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);
}
}