On Thu, 21 Jul 2005 10:06:15 +0400, Anton Farygin wrote:
> Hi !
>
> I'm build powersave-0.9.25 for ALT Linux and resolve bug into powersaved
> polling code (incorrect timespec calclualtion for poll interval).
>
> With this patch powersaved works fine.
>
oops.
corrected patch:
diff -urN powersave-0.9.25.orig/daemon/powersaved.cpp
powersave-0.9.25/daemon/powersaved.cpp
--- powersave-0.9.25.orig/daemon/powersaved.cpp 2005-03-19 18:36:52 +0300
+++ powersave-0.9.25/daemon/powersaved.cpp 2005-07-05 20:10:28 +0400
@@ -504,12 +504,13 @@
req.tv_usec = 0;
}
else {
- req.tv_sec = config->current_scheme->POLL_INTERVAL /
1000
- - process_time / (1000*1000);
- req.tv_usec = (config->current_scheme->POLL_INTERVAL *
1000 % 1000000)
- - process_time % (1000*1000);
+ struct timeval timedec;
+ req.tv_sec = config->current_scheme->POLL_INTERVAL /
1000;
+ req.tv_usec = (config->current_scheme->POLL_INTERVAL *
1000 % 1000000);
+ timersub(&tv_stop,&tv_start,&timedec);
+ timersub(&req, &timedec, &req);
pDebug (DBG_DEBUG, "Needed %lu sec and %lu usec time to
process functions after select\n",
- process_time / (1000*1000), process_time % (1000*1000));
+ timedec.tv_sec,timedec.tv_usec);
}
}
}
_______________________________________________
powersave-devel mailing list
[EMAIL PROTECTED]
http://forge.novell.com/mailman/listinfo/powersave-devel