mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix: battery time remaining
time is reported in second and should be divided by 3600 and not 1000.
This commit is contained in:
parent
f0bead34d4
commit
120cba0f5e
@ -505,12 +505,12 @@ const std::tuple<uint8_t, float, std::string, float> waybar::modules::Battery::g
|
|||||||
|
|
||||||
float time_remaining{0.0f};
|
float time_remaining{0.0f};
|
||||||
if (status == "Discharging" && time_to_empty_now_exists) {
|
if (status == "Discharging" && time_to_empty_now_exists) {
|
||||||
if (time_to_empty_now != 0) time_remaining = (float)time_to_empty_now / 1000.0f;
|
if (time_to_empty_now != 0) time_remaining = (float)time_to_empty_now / 3600.0f;
|
||||||
} else if (status == "Discharging" && total_power_exists && total_energy_exists) {
|
} else if (status == "Discharging" && total_power_exists && total_energy_exists) {
|
||||||
if (total_power != 0) time_remaining = (float)total_energy / total_power;
|
if (total_power != 0) time_remaining = (float)total_energy / total_power;
|
||||||
} else if (status == "Charging" && time_to_full_now_exists) {
|
} else if (status == "Charging" && time_to_full_now_exists) {
|
||||||
if (time_to_full_now_exists && (time_to_full_now != 0))
|
if (time_to_full_now_exists && (time_to_full_now != 0))
|
||||||
time_remaining = -(float)time_to_full_now / 1000.0f;
|
time_remaining = -(float)time_to_full_now / 3600.0f;
|
||||||
// If we've turned positive it means the battery is past 100% and so just report that as no
|
// If we've turned positive it means the battery is past 100% and so just report that as no
|
||||||
// time remaining
|
// time remaining
|
||||||
if (time_remaining > 0.0f) time_remaining = 0.0f;
|
if (time_remaining > 0.0f) time_remaining = 0.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user