[Xfce4-commits] [panel-plugins/xfce4-hardware-monitor-plugin] 03/03: There are 1024 bytes in a KB...
noreply at xfce.org
noreply at xfce.org
Sun Aug 16 20:40:01 CEST 2015
This is an automated email from the git hooks/post-receive script.
omegaphil pushed a commit to branch master
in repository panel-plugins/xfce4-hardware-monitor-plugin.
commit a02b0ec09bc8ac26776b12355a5c96072e322f59
Author: OmegaPhil <OmegaPhil at startmail.com>
Date: Sun Aug 16 19:38:31 2015 +0100
There are 1024 bytes in a KB...
Fixes https://bugzilla.xfce.org/show_bug.cgi?id=12100
---
src/monitor-impls.cpp | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/monitor-impls.cpp b/src/monitor-impls.cpp
index 552cd1b..9cb8099 100644
--- a/src/monitor-impls.cpp
+++ b/src/monitor-impls.cpp
@@ -420,7 +420,7 @@ Glib::ustring SwapUsageMonitor::format_value(double val, bool compact)
{
Glib::ustring format = compact ? _("%1M"): _("%1 MB");
- val /= 1000000;
+ val /= 1048576;
return String::ucompose(format, decimal_digits(val, 3), val);
}
@@ -581,7 +581,7 @@ Glib::ustring MemoryUsageMonitor::format_value(double val, bool compact)
{
Glib::ustring format = compact ? _("%1M") : _("%1 MB");
- val /= 1000000;
+ val /= 1048576;
return String::ucompose(format, decimal_digits(val, 3), val);
}
@@ -660,18 +660,18 @@ Glib::ustring DiskUsageMonitor::format_value(double val, bool compact)
{
Glib::ustring format;
- if (val >= 1000 * 1000 * 1000) {
- val /= 1000 * 1000 * 1000;
+ if (val >= 1024 * 1024 * 1024) {
+ val /= 1024 * 1024 * 1024;
format = compact ? _("%1G") : _("%1 GB");
return String::ucompose(format, decimal_digits(val, 3), val);
}
- else if (val >= 1000 * 1000) {
- val /= 1000 * 1000;
+ else if (val >= 1024 * 1024) {
+ val /= 1024 * 1024;
format = compact ? _("%1M") : _("%1 MB");
return String::ucompose(format, decimal_digits(val, 3), val);
}
- else if (val >= 1000) {
- val /= 1000;
+ else if (val >= 1024) {
+ val /= 1024;
format = compact ? _("%1K"): _("%1 KB");
return String::ucompose(format, decimal_digits(val, 3), val);
}
@@ -813,18 +813,18 @@ Glib::ustring NetworkLoadMonitor::format_value(double val, bool compact)
if (val <= 0) // fix weird problem with negative values
val = 0;
- if (val >= 1000 * 1000 * 1000) {
- val /= 1000 * 1000 * 1000;
+ if (val >= 1024 * 1024 * 1024) {
+ val /= 1024 * 1024 * 1024;
format = compact ? _("%1G") : _("%1 GB/s");
return String::ucompose(format, decimal_digits(val, 3), val);
}
- else if (val >= 1000 * 1000) {
- val /= 1000 * 1000;
+ else if (val >= 1024 * 1024) {
+ val /= 1024 * 1024;
format = compact ? _("%1M") : _("%1 MB/s");
return String::ucompose(format, decimal_digits(val, 3), val);
}
- else if (val >= 1000) {
- val /= 1000;
+ else if (val >= 1024) {
+ val /= 1024;
format = compact ? _("%1K") : _("%1 KB/s");
return String::ucompose(format, decimal_digits(val, 3), val);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list