aboutsummaryrefslogtreecommitdiff
path: root/src/qt/trafficgraphwidget.cpp
diff options
context:
space:
mode:
authorwodry <wodry@users.noreply.github.com>2021-03-15 15:14:54 +0100
committerwodry <wodry@users.noreply.github.com>2021-03-19 19:35:42 +0100
commitd09ebc47233187ab8dd5a70df4d261353958978c (patch)
treeaef27d4eadd68309d543d12de59eb462a5440002 /src/qt/trafficgraphwidget.cpp
parenteceb3f7707d6793152a00476adae1c4e268ce6f3 (diff)
Fix wrong(1024) divisor for 1000-based prefixes
Diffstat (limited to 'src/qt/trafficgraphwidget.cpp')
-rw-r--r--src/qt/trafficgraphwidget.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp
index dabdf9d887..7e12410c80 100644
--- a/src/qt/trafficgraphwidget.cpp
+++ b/src/qt/trafficgraphwidget.cpp
@@ -79,7 +79,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
int base = floor(log10(fMax));
float val = pow(10.0f, base);
- const QString units = tr("KB/s");
+ const QString units = tr("kB/s");
const float yMarginText = 2.0;
// draw lines
@@ -128,10 +128,10 @@ void TrafficGraphWidget::updateRates()
quint64 bytesIn = clientModel->node().getTotalBytesRecv(),
bytesOut = clientModel->node().getTotalBytesSent();
- float inRate = (bytesIn - nLastBytesIn) / 1024.0f * 1000 / timer->interval();
- float outRate = (bytesOut - nLastBytesOut) / 1024.0f * 1000 / timer->interval();
- vSamplesIn.push_front(inRate);
- vSamplesOut.push_front(outRate);
+ float in_rate_kilobytes_per_sec = static_cast<float>(bytesIn - nLastBytesIn) / timer->interval();
+ float out_rate_kilobytes_per_sec = static_cast<float>(bytesOut - nLastBytesOut) / timer->interval();
+ vSamplesIn.push_front(in_rate_kilobytes_per_sec);
+ vSamplesOut.push_front(out_rate_kilobytes_per_sec);
nLastBytesIn = bytesIn;
nLastBytesOut = bytesOut;