diff options
author | Simon Rettberg | 2022-01-14 13:19:30 +0100 |
---|---|---|
committer | Simon Rettberg | 2022-01-14 13:19:30 +0100 |
commit | 600e1c92fd3e3e576fa8978473d956911e874b09 (patch) | |
tree | 2608df456ff392ceea0bf909a15cf13d9f09fbd9 | |
parent | Fix sleep time calculation for logout timeout as well (diff) | |
download | idle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.tar.gz idle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.tar.xz idle-daemon-600e1c92fd3e3e576fa8978473d956911e874b09.zip |
-rw-r--r-- | src/main.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |