summaryrefslogtreecommitdiffstats
path: root/NetworkIOMeter.c
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2023-11-02 03:29:39 +0800
committerBenBE <BenBE@geshi.org>2023-11-24 09:51:25 +0100
commitfda3d1026187387b71ff056828c5a22156cdc8da (patch)
tree0f3358d93910054e7b72710459f53118dba47c1e /NetworkIOMeter.c
parentd4746896891188c55a026ba69d9ac11b312f4788 (diff)
Cache NetworkIOMeter values in 'double' type
Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Diffstat (limited to 'NetworkIOMeter.c')
-rw-r--r--NetworkIOMeter.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c
index dd7db422..ac453d89 100644
--- a/NetworkIOMeter.c
+++ b/NetworkIOMeter.c
@@ -27,10 +27,10 @@ static const int NetworkIOMeter_attributes[] = {
};
static MeterRateStatus status = RATESTATUS_INIT;
-static uint32_t cached_rxb_diff;
+static double cached_rxb_diff;
static char cached_rxb_diff_str[6];
static uint32_t cached_rxp_diff;
-static uint32_t cached_txb_diff;
+static double cached_txb_diff;
static char cached_txb_diff_str[6];
static uint32_t cached_txp_diff;
@@ -71,7 +71,7 @@ static void NetworkIOMeter_updateValues(Meter* this) {
diff = data.bytesReceived - cached_rxb_total;
diff = (1000 * diff) / passedTimeInMs; /* convert to B/s */
diff /= ONE_K; /* convert to KiB/s */
- cached_rxb_diff = (uint32_t)diff;
+ cached_rxb_diff = diff;
} else {
cached_rxb_diff = 0;
}
@@ -89,7 +89,7 @@ static void NetworkIOMeter_updateValues(Meter* this) {
diff = data.bytesTransmitted - cached_txb_total;
diff = (1000 * diff) / passedTimeInMs; /* convert to B/s */
diff /= ONE_K; /* convert to KiB/s */
- cached_txb_diff = (uint32_t)diff;
+ cached_txb_diff = diff;
} else {
cached_txb_diff = 0;
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy