| Server IP : 82.208.35.60 / Your IP : 216.73.216.89 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/sysutils/upower/files/ |
Upload File : |
--- src/up-device-battery.c.orig 2022-07-21 09:06:49 UTC
+++ src/up-device-battery.c
@@ -19,6 +19,7 @@
*/
#include <string.h>
+#include <math.h>
#include "up-constants.h"
#include "up-config.h"
@@ -125,7 +126,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
continue;
/* Stop searching if the new reference is further away from the long timeout. */
- if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
+ if (labs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - labs (td)) > labs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
break;
ref_td = td;
@@ -155,7 +156,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
*/
if (cur->state == UP_DEVICE_STATE_UNKNOWN) {
/* Consider a rate of 0.5W as "no change", otherwise set CHARGING/DISCHARGING */
- if (abs(energy_rate) < 0.5)
+ if (fabs(energy_rate) < 0.5)
return;
else if (energy_rate < 0.0)
cur->state = UP_DEVICE_STATE_DISCHARGING;