summary refs log tree commit diff
path: root/handle.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-11 04:00:25 -0500
committerJune McEnroe <june@causal.agency>2020-02-11 04:00:25 -0500
commitac4876718f268326f34ad4fc58a9811f7a869949 (patch)
tree0279d25c610f33bbc6a0ce712043bf7f933d4c05 /handle.c
parentCast towupper to wchar_t (diff)
downloadcatgirl-ac4876718f268326f34ad4fc58a9811f7a869949.tar.gz
catgirl-ac4876718f268326f34ad4fc58a9811f7a869949.zip
Fix whois idle unit calculation
Rookie mistake.
Diffstat (limited to '')
-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),