diff options
-rw-r--r-- | src/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -279,17 +279,18 @@ int main( int argc, char **argv ) } CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 + 2 ) ); } else { - CAP_SLEEP( remaining - 299 ); + CAP_SLEEP( remaining - 305 ); } } } do { + const time_t oldDeadline = nextAction.deadline; // Handle requests rpcHandle( listenFd ); // Might have set a new scheduled action - if ( nextAction.deadline != 0 && nextAction.force ) { + if ( nextAction.deadline != oldDeadline ) { int delta = nextAction.deadline - monoNOW; - CAP_SLEEP( delta ); + CAP_SLEEP( delta - 305 ); } // Sleep until next run //printf( "Sleeping %d seconds\n ", sleepTime ); |