aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/e_powersave.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-09-12 11:02:44 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-09-12 11:03:50 +0900
commit9eebe065c262e0763649bb9f2dc1b0b9e2d434fe (patch)
tree323f80e62c63d1bcf8fe7cca3224da71a6ba856e /src/bin/e_powersave.c
parentRevert "Temperature module: Don't use e_powersave_sleep. It doesn't work for... (diff)
downloadenlightenment-9eebe065c262e0763649bb9f2dc1b0b9e2d434fe.tar.gz
e powerszve - fix sleep timeout for select to be correct
bad inverse fmod and using int not double first before converting to microseconds...
Diffstat (limited to 'src/bin/e_powersave.c')
-rw-r--r--src/bin/e_powersave.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/e_powersave.c b/src/bin/e_powersave.c
index 9d4349eeb..55021b38d 100644
--- a/src/bin/e_powersave.c
+++ b/src/bin/e_powersave.c
@@ -164,6 +164,7 @@ e_powersave_sleeper_free(E_Powersave_Sleeper *sleeper)
E_API void
e_powersave_sleeper_sleep(E_Powersave_Sleeper *sleeper, int poll_interval)
{
+ double timf;
unsigned int tim;
fd_set rfds, wfds, exfds;
struct timeval tv;
@@ -171,14 +172,14 @@ e_powersave_sleeper_sleep(E_Powersave_Sleeper *sleeper, int poll_interval)
char buf[1] = { 1 };
if (!sleeper) return;
- if (e_powersave_mode_get() == E_POWERSAVE_MODE_FREEZE) tim = 3600;
- else tim = (double)poll_interval / 8.0;
+ if (e_powersave_mode_get() == E_POWERSAVE_MODE_FREEZE) timf = 3600;
+ else timf = (double)poll_interval / 8.0;
FD_ZERO(&rfds);
FD_ZERO(&wfds);
FD_ZERO(&exfds);
FD_SET(sleeper->fd, &rfds);
- tim = (fmod(ecore_time_get(), tim) * 1000000.0);
+ tim = ((timf - fmod(ecore_time_get(), timf)) * 1000000.0);
tv.tv_sec = tim / 1000000;
tv.tv_usec = tim % 1000000;
for (;;)