summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-05-23 13:33:05 +0200
committerSimon Rettberg2019-05-23 13:33:05 +0200
commitbd57a22c8bebdd012faf393c819c8f8888e152eb (patch)
tree1cdc48a0367140c20ef8b20f44878b8ca52b1800
parentRefine timings (diff)
downloadidle-daemon-bd57a22c8bebdd012faf393c819c8f8888e152eb.tar.gz
idle-daemon-bd57a22c8bebdd012faf393c819c8f8888e152eb.tar.xz
idle-daemon-bd57a22c8bebdd012faf393c819c8f8888e152eb.zip
Make sure user promptly sees warning when using RPC
-rw-r--r--src/main.c7
1 files 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 );