ports/x11-servers/xorg-server/files/patch-os-utils.c
Sean Farley 227228845c x11-servers/xorg-server: patch to utilize CLOCK_MONOTONIC_FAST for the clock
This patches the X server to use CLOCK_MONOTONIC_FAST instead of
CLOCK_MONOTONIC for the clock.  This is basically a reintroduction of
r208485 by jkim@ that was removed by accident(?).

Since the X server is fine with the Linux _COARSE clock the accuracy of
the FreeBSD _FAST clock should work too.  I have run with this patch for
a long time without ill effects.

PR:		252816
Reviewed by:	imp, markj, jkim, mhorne
Approved by:	x11
2021-07-01 12:30:11 -06:00

18 lines
676 B
C

--- os/utils.c.orig 2014-04-15 01:01:57 UTC
+++ os/utils.c
@@ -443,11 +443,11 @@ GetTimeInMillis(void)
static clockid_t clockid;
if (!clockid) {
-#ifdef CLOCK_MONOTONIC_COARSE
- if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
+#ifdef CLOCK_MONOTONIC_FAST
+ if (clock_getres(CLOCK_MONOTONIC_FAST, &tp) == 0 &&
(tp.tv_nsec / 1000) <= 1000 &&
- clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
- clockid = CLOCK_MONOTONIC_COARSE;
+ clock_gettime(CLOCK_MONOTONIC_FAST, &tp) == 0)
+ clockid = CLOCK_MONOTONIC_FAST;
else
#endif
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)