From eb3c45cbd9fef863fac4777ce4dae3eb6cd23df6 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 24 Feb 2025 20:18:56 +0100 Subject: [PATCH] (macOS) Fixed an issue where the battery capacity was not calculated correctly --- es-core/src/SystemStatus.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/es-core/src/SystemStatus.cpp b/es-core/src/SystemStatus.cpp index 8c7e86b56..483782353 100644 --- a/es-core/src/SystemStatus.cpp +++ b/es-core/src/SystemStatus.cpp @@ -382,8 +382,10 @@ void SystemStatus::getStatusBattery() static_cast(CFDictionaryGetValue(source, CFSTR(kIOPSMaxCapacityKey)))}; CFNumberGetValue(maxCapacityNum, kCFNumberIntType, &maxCapacity); - if (maxCapacity > 0) - batteryCapacity = curCapacity / maxCapacity * 100; + if (maxCapacity > 0) { + batteryCapacity = + static_cast(curCapacity) / static_cast(maxCapacity) * 100.0f; + } } }