From bd57a22c8bebdd012faf393c819c8f8888e152eb Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 23 May 2019 13:33:05 +0200 Subject: Make sure user promptly sees warning when using RPC --- src/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index cb4a47e..81879b5 100644 --- a/src/main.c +++ b/src/main.c @@ -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 ); -- cgit v1.2.3-55-g7522