systemusage: fix integer overflow

This commit is contained in:
2 * r + 2 * t 2025-06-25 01:06:45 +10:00
parent cebb6270e4
commit 3f981680ef

View file

@ -12,17 +12,17 @@ Singleton {
property string gpuType: "NONE" property string gpuType: "NONE"
property real gpuPerc property real gpuPerc
property real gpuTemp property real gpuTemp
property int memUsed property real memUsed
property int memTotal property real memTotal
readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0 readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0
property int storageUsed property real storageUsed
property int storageTotal property real storageTotal
property real storagePerc: storageTotal > 0 ? storageUsed / storageTotal : 0 property real storagePerc: storageTotal > 0 ? storageUsed / storageTotal : 0
property int lastCpuIdle property real lastCpuIdle
property int lastCpuTotal property real lastCpuTotal
function formatKib(kib: int): var { function formatKib(kib: real): var {
const mib = 1024; const mib = 1024;
const gib = 1024 ** 2; const gib = 1024 ** 2;
const tib = 1024 ** 3; const tib = 1024 ** 3;