From 788b4fc23f8b89414094bd428e91321fedeffc57 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 3 Jan 2025 03:30:40 -0500
Subject: [PATCH] Another attempt to silence Coverity.

This may be the first time in my life that I've used difftime()...
which is strictly one of only two things you're actually allowed
to do with a time_t per the C standard (the other is convert into
a broken-down time).
---
 src/syncterm/term.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/syncterm/term.c b/src/syncterm/term.c
index 6518e031a4..2b049022cb 100644
--- a/src/syncterm/term.c
+++ b/src/syncterm/term.c
@@ -334,6 +334,7 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
 	static int        oldspeed = 0;
 	static int        lastmouse = 0;
 	int               newmouse;
+	double            timeond;
 	int               timeon;
 	char              sep;
 	int               oldfont_norm;
@@ -378,12 +379,13 @@ update_status(struct bbslist *bbs, int speed, int ooii_mode, bool ata_inv)
 	lastupd = now;
 	lastmouse = newmouse;
 	oldspeed = speed;
-	if (now > (bbs->connected + 359999))
+	timeond = difftime(now, bbs->connected);
+	if (timeond > 350000)
 		timeon = 350000;
-	else if (now < bbs->connected)
+	else if (timeond < 0)
 		timeon = 0;
 	else
-		timeon = (int)(now - bbs->connected);
+		timeon = timeond;
 	gettextinfo(&txtinfo);
 	oldscroll = _wscroll;
 	hold_update = true;
-- 
GitLab