summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2022-01-14 13:19:30 +0100
committerSimon Rettberg2022-01-14 13:19:30 +0100
commit600e1c92fd3e3e576fa8978473d956911e874b09 (patch)
tree2608df456ff392ceea0bf909a15cf13d9f09fbd9 /src
parentFix sleep time calculation for logout timeout as well (diff)
downloadidle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.tar.gz
idle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.tar.xz
idle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.zip
Cap sleep time to 5 after RPC activityv29r2v29r1
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 316aec5..138713f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -316,9 +316,12 @@ int main( int argc, char **argv )
//printf( "Sleeping %d seconds\n ", sn );
if ( rpc_wait( listenFd, sn < 1 ? 1 : sn ) ) {
rpc_handle( listenFd );
- // Might have set a new scheduled action, run main loop again
if ( nextAction.deadline != oldDeadline ) {
+ // Might have set a new scheduled action, run main loop again soon
CAP_SLEEP( 1 );
+ } else {
+ // Otherwise, still update rather quickly, in case we get polled again
+ CAP_SLEEP( 5 );
}
}
// Detect time changes
@@ -329,6 +332,7 @@ int main( int argc, char **argv )
// Adjust for clock changes
const int diff = ( endWall - startWall ) - ( endMono - startMono );
if ( diff != 0 ) {
+ printf( "Correcting time by %d seconds\n", diff );
for ( idx = 0; idx < count; ++idx ) {
if ( users[idx].display[0] == '\0' )
continue;