[9ae8f17cfc8ba7fd8fb34b2a194ef965a3b36a40839a46eeab1350e916692ac9/wip/high-res-server-time-really-isnt-system-time: 5/7] x11: Don't compare server time with monotonic time when checking for drift
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [9ae8f17cfc8ba7fd8fb34b2a194ef965a3b36a40839a46eeab1350e916692ac9/wip/high-res-server-time-really-isnt-system-time: 5/7] x11: Don't compare server time with monotonic time when checking for drift
- Date: Wed, 8 Jul 2020 13:28:40 +0000 (UTC)
commit f1e9a048bd24fde5960cc85bed9b4161f834d0aa
Author: Ray Strode <rstrode redhat com>
Date: Tue Jul 7 16:19:28 2020 -0400
x11: Don't compare server time with monotonic time when checking for drift
In order to catch clock drift, gtk recomputes the offset between
the client and x server time every 10 seconds. Unfortunately, it does
this by comparing the system monotonic time with X server timestamps.
These are not directly comparable. This commit fixes the code to
instead compare one x server timestamp with a previous x server
timestamp when deciding if 10 seconds has passed.
gdk/x11/gdkdisplay-x11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index a882ba5f195..ac82a1c0d1f 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1317,7 +1317,7 @@ server_time_to_monotonic_time (GdkX11Display *display_x11,
gint64 current_server_time = gdk_x11_get_server_time (display_x11->leader_gdk_window);
gint64 current_server_time_usec = (gint64)current_server_time * 1000;
gint64 current_monotonic_time = g_get_monotonic_time ();
- display_x11->server_time_query_time = current_monotonic_time;
+ display_x11->server_time_query_time = current_server_time_usec;
/* If the server time is within a second of the monotonic time,
* we assume that they are identical. This seems like a big margin,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]