From 8040c8fe05bf5eeee34f94e7b0a92a88c0160feb Mon Sep 17 00:00:00 2001
From: Eidolon <furyhunter600@gmail.com>
Date: Sat, 21 May 2022 12:32:40 -0500
Subject: [PATCH] Tweaks for kart v1 MR comments

---
 src/i_time.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/i_time.c b/src/i_time.c
index c86973f6e9..c1cc9dfd44 100644
--- a/src/i_time.c
+++ b/src/i_time.c
@@ -30,6 +30,12 @@ static precise_t enterprecise, oldenterprecise;
 static fixed_t entertic, oldentertics;
 static double tictimer;
 
+// A little more than the minimum sleep duration on Windows.
+// May be incorrect for other platforms, but we don't currently have a way to
+// query the scheduler granularity. SDL will do what's needed to make this as
+// low as possible though.
+#define MIN_SLEEP_DURATION_MS 2.1
+
 tic_t I_GetTime(void)
 {
 	return g_time.time;
@@ -90,7 +96,7 @@ void I_SleepDuration(precise_t duration)
 	precise_t dest;
 
 	{
-		double gran = round(((double)(precision / 1000) * sleepvalue * 2.1));
+		double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS));
 		delaygranularity = (UINT64)gran;
 	}
 
-- 
GitLab