diff --git a/src/core/window.c b/src/core/window.c
index d2deb53..f3b53cf 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -9626,8 +9626,16 @@ meta_window_set_user_time (MetaWindow *window,
 
   g_return_if_fail (!window->override_redirect);
 
+  guint32 current_time = meta_display_get_current_time_roundtrip(window->display);
+  if (timestamp > current_time)
+    {
+      meta_warning ("Ignoring future timestamp %u for window %s\n"
+                    "Current timestamp is %u\n", timestamp, window->desc,
+                    current_time);
+      return;
+    }
   /* Only update the time if this timestamp is newer... */
-  if (window->net_wm_user_time_set &&
+  else if (window->net_wm_user_time_set &&
       XSERVER_TIME_IS_BEFORE (timestamp, window->net_wm_user_time))
     {
       meta_topic (META_DEBUG_STARTUP,
