From 9ab9b36fb8938e45e5d15fba22deb3cfc0555e4c Mon Sep 17 00:00:00 2001
From: = <=>
Date: Sat, 19 Jul 2014 17:24:20 +0200
Subject: [PATCH] Display network speed in MiB if the speed is higher than 1024
KiB.
---
src/apps/activitymonitor/DataSource.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/apps/activitymonitor/DataSource.cpp b/src/apps/activitymonitor/DataSource.cpp
index c493593..5b5a1ae 100644
a
|
b
|
void
|
1225 | 1225 | NetworkUsageDataSource::Print(BString& text, int64 value) const |
1226 | 1226 | { |
1227 | 1227 | char buffer[32]; |
1228 | | snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f KiB/s"), value / 1024.0); |
| 1228 | |
| 1229 | if (value < 1024.0 * 1024.0) { |
| 1230 | snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f KiB/s"), value / 1024.0); |
| 1231 | } else { |
| 1232 | snprintf(buffer, sizeof(buffer), B_TRANSLATE("%.1f MiB/s"), value / 1024.0 / 1024.0); |
| 1233 | } |
1229 | 1234 | |
1230 | 1235 | text = buffer; |
1231 | 1236 | } |