summary refs log tree commit diff
diff options
context:
space:
mode:
authorC. McEnroe2020-02-11 04:00:25 -0500
committerC. McEnroe2020-02-11 04:00:25 -0500
commitac4876718f268326f34ad4fc58a9811f7a869949 (patch)
tree0279d25c610f33bbc6a0ce712043bf7f933d4c05
parent86fac7caadfbefa6f044314d440deefb480133d7 (diff)
Fix whois idle unit calculation
Rookie mistake.
-rw-r--r--handle.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/handle.c b/handle.c
index ce56a51..f76a181 100644
--- a/handle.c
+++ b/handle.c
@@ -407,9 +407,15 @@ static void handleReplyWhoisIdle(struct Message *msg) {
 	if (!replies.whois) return;
 	unsigned long idle = strtoul(msg->params[2], NULL, 10);
 	const char *unit = "second";
-	if (idle / 60) { idle /= 60; unit = "minute"; }
-	if (idle / 60) { idle /= 60; unit = "hour"; }
-	if (idle / 24) { idle /= 24; unit = "day"; }
+	if (idle / 60) {
+		idle /= 60; unit = "minute";
+		if (idle / 60) {
+			idle /= 60; unit = "hour";
+			if (idle / 24) {
+				idle /= 24; unit = "day";
+			}
+		}
+	}
 	time_t signon = (msg->params[3] ? strtoul(msg->params[3], NULL, 10) : 0);
 	uiFormat(
 		Network, Warm, tagTime(msg),