Ticket #11053: 0001-Display-network-speed-in-MiB-if-the-speed-is-higher-.patch

File 0001-Display-network-speed-in-MiB-if-the-speed-is-higher-.patch, 979 bytes (added by dsjonny, 10 years ago)
  • src/apps/activitymonitor/DataSource.cpp

    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  
    12251225NetworkUsageDataSource::Print(BString& text, int64 value) const
    12261226{
    12271227    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    }
    12291234
    12301235    text = buffer;
    12311236}