mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
(macOS) Fixed an issue where the battery capacity was not calculated correctly
This commit is contained in:
parent
4c06ef2dc3
commit
eb3c45cbd9
|
|
@ -382,8 +382,10 @@ void SystemStatus::getStatusBattery()
|
||||||
static_cast<CFNumberRef>(CFDictionaryGetValue(source, CFSTR(kIOPSMaxCapacityKey)))};
|
static_cast<CFNumberRef>(CFDictionaryGetValue(source, CFSTR(kIOPSMaxCapacityKey)))};
|
||||||
CFNumberGetValue(maxCapacityNum, kCFNumberIntType, &maxCapacity);
|
CFNumberGetValue(maxCapacityNum, kCFNumberIntType, &maxCapacity);
|
||||||
|
|
||||||
if (maxCapacity > 0)
|
if (maxCapacity > 0) {
|
||||||
batteryCapacity = curCapacity / maxCapacity * 100;
|
batteryCapacity =
|
||||||
|
static_cast<float>(curCapacity) / static_cast<float>(maxCapacity) * 100.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue