aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/shutdown.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2023-12-18 22:04:38 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2023-12-18 22:04:38 +0100
commit46cb0be64f8a57057a5f434d579330ee9eb0e258 (patch)
treeccdc45eb261b34817234f5e776cc75c66f052f8f /FICS/shutdown.c
parent4091baee1851626140043af00be215665730efc8 (diff)
Reformatted check_and_print_shutdown() and changed the type of var 't' to 'time_t'
Diffstat (limited to 'FICS/shutdown.c')
-rw-r--r--FICS/shutdown.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/FICS/shutdown.c b/FICS/shutdown.c
index dab8ca3..382681b 100644
--- a/FICS/shutdown.c
+++ b/FICS/shutdown.c
@@ -102,30 +102,31 @@ PUBLIC void ShutHeartBeat(void)
}
}
-PUBLIC int check_and_print_shutdown(int p)
-
- /* Tells a user if they is to be a shutdown */
- /* returns 0 if there is not to be one, 1 if there is to be one */
- /* for whenshut command */
-
+/*
+ * Tells a user about a shutdown. Returns 1 if there is to be one, and
+ * 0 otherwise. (For 'whenshut' command.)
+ */
+PUBLIC int
+check_and_print_shutdown(int p)
{
+ int timeLeft;
+ time_t t = time(NULL);
+ if (!shutdownTime)
+ return 0; // no shutdown
- int timeLeft;
- int t = time(0);
+ timeLeft = shutdownTime - (t - shutdownStartTime);
- if (!shutdownTime)
- return 0; /* no shut down */
-
- timeLeft = shutdownTime - (t - shutdownStartTime);
+ pprintf(p, "\n **** Server going down in %d minutes and %d seconds. "
+ "****\n",
+ (timeLeft / 60),
+ timeLeft - ((timeLeft / 60) * 60));
- pprintf(p,
- "\n **** Server going down in %d minutes and %d seconds. ****\n",
- timeLeft / 60,
- timeLeft - ((timeLeft / 60) * 60));
- if (reason[0] != '\0')
- pprintf(p, "\n **** We are going down because: %s. ****\n", reason);
- return 1;
+ if (reason[0] != '\0') {
+ pprintf(p, "\n **** We are going down because: %s. ****\n",
+ reason);
+ }
+ return 1;
}