diff options
-rw-r--r-- | src/main.c | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -191,10 +191,12 @@ int main( int argc, char **argv ) warnUser( usr, WARN_LOGOUT, remaining ); CAP_SLEEP( remaining ); } else if ( remaining < 310 ) { - warnUser( usr, WARN_LOGOUT_LOW, remaining ); - CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 ) ); + if ( remaining % 30 < 10 ) { + warnUser( usr, WARN_LOGOUT_LOW, remaining ); + } + CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 + 2 ) ); } else { - CAP_SLEEP( remaining - 300 ); + CAP_SLEEP( remaining - 299 ); } usr->logoutTime = NOW + remaining; } @@ -264,16 +266,18 @@ int main( int argc, char **argv ) nextAction.disarmed = true; nextAction.force = false; } else if ( remaining < 310 ) { - enum Warning w = WARN_REBOOT; - if ( nextAction.action == POWEROFF ) { - w = WARN_POWEROFF; - } - for ( idx = 0; idx < count; ++idx ) { - warnUser( &users[idx], w, remaining ); + if ( remaining % 30 < 10 ) { + enum Warning w = WARN_REBOOT; + if ( nextAction.action == POWEROFF ) { + w = WARN_POWEROFF; + } + for ( idx = 0; idx < count; ++idx ) { + warnUser( &users[idx], w, remaining ); + } } - CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 ) ); + CAP_SLEEP( remaining - ( ( remaining - 30 ) / 60 * 60 + 2 ) ); } else { - CAP_SLEEP( remaining ); + CAP_SLEEP( remaining - 299 ); } } } |