Index | Thread | Search

From:
Thorsten Blum <thorsten.blum@toblux.com>
Subject:
kern_time: Use abs() to replace open code
To:
tech@openbsd.org
Date:
Wed, 9 Oct 2024 10:40:31 +0200

Download raw body.

Thread
Index: kern_time.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_time.c,v
retrieving revision 1.170
diff -u -p -r1.170 kern_time.c
--- kern_time.c	3 Oct 2024 10:18:29 -0000	1.170
+++ kern_time.c	8 Oct 2024 22:44:37 -0000
@@ -956,9 +956,7 @@ inittodr(time_t base)
 		 * See if we gained/lost two or more days; if
 		 * so, assume something is amiss.
 		 */
-		deltat = rtctime.tv_sec - base;
-		if (deltat < 0)
-			deltat = -deltat;
+		deltat = abs(rtctime.tv_sec - base);
 		if (deltat < 2 * SECDAY)
 			return;         /* all is well */
 #ifndef SMALL_KERNEL