make os compatible

This commit is contained in:
jkre 2023-12-15 01:28:57 +01:00
parent a81b514d6d
commit 0c706cd20a
1 changed files with 4 additions and 4 deletions

View File

@ -187,7 +187,7 @@ namespace Cpu {
string cpuHz; string cpuHz;
bool has_battery = true; bool has_battery = true;
bool macM1 = false; bool macM1 = false;
tuple<int, long, string> current_bat; tuple<int, float, long, string> current_bat;
const array<string, 10> time_names = {"user", "nice", "system", "idle"}; const array<string, 10> time_names = {"user", "nice", "system", "idle"};
@ -398,8 +398,8 @@ namespace Cpu {
~IOPSList_Wrap() { CFRelease(data); } ~IOPSList_Wrap() { CFRelease(data); }
}; };
auto get_battery() -> tuple<int, long, string> { auto get_battery() -> tuple<int, float, long, string> {
if (not has_battery) return {0, 0, ""}; if (not has_battery) return {0, 0, 0, ""};
uint32_t percent = -1; uint32_t percent = -1;
long seconds = -1; long seconds = -1;
@ -438,7 +438,7 @@ namespace Cpu {
has_battery = false; has_battery = false;
} }
} }
return {percent, seconds, status}; return {percent, -1, seconds, status};
} }
auto collect(bool no_update) -> cpu_info & { auto collect(bool no_update) -> cpu_info & {