Bug 1539

Summary: Changing system time changes X timestamp
Product: xorg Reporter: Lubos Lunak <l.lunak>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: kem
Version: 6.8.0   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
testapp showing current X time none

Description Lubos Lunak 2004-10-05 07:08:20 UTC
After changing system time (e.g. going 5 months back and then going back to the 
current date triggers it in my case), the X timestamp is changed as well. This 
triggers e.g. KDE bug #90795 (http://bugs.kde.org/show_bug.cgi?id=90795). The 
best description of the timestamp I've found, in the glossary of the protocol 
specification, is a bit vague, but I think changing system time should not affect X 
timestamp. The X timestamp is no real time, and is used only to ensure ordering. 
Changing it when system time changes can e.g. make recent timestamps to become 
suddenly very old timestamp, thus breaking various things.
Comment 1 Adam Jackson 2004-10-05 14:43:06 UTC
the X server has no way of knowing when the system time changes from under it. 
the timestamp is specified in milliseconds from server startup, and the only way
to get that is to call gettimeofday().  gettimeofday() warps when you change the
system clock.

if you can come up with a portable way to calculate the time since server
startup in milliseconds that doesn't warp when the system clock changes, that'd
be great.  until then this isn't fixable.
Comment 2 Mike A. Harris 2004-10-06 22:01:18 UTC
I disagree with the resolution "WONTFIX".  This problem existed in the
X server a long time ago, and was subsequently fixed in the XFree86 4.1.0
era by bug fixes to GetTimeInMillis().

Either the bug exists, can be verified by other people, and thus should be
fixed, or it can not be verified, doesn't exist and then WONTFIX is a
reasonable resolution.

I don't see this as an unfixable problem.  Reopening.
Comment 3 Mike A. Harris 2004-10-06 22:06:21 UTC
Actually, WONTFIX is not reasonable at all.  If it isn't reproduceable
then WORKSFORME is the appropriate resolution.  I've seen various people
report this problem via email lists and IRC however, so I'm inclined
to think it's a real bug.
Comment 4 Lubos Lunak 2004-10-07 03:40:14 UTC
Created attachment 1027 [details]
testapp showing current X time

I used SUSE packages, but according to the packagers there shouldn't be any
patch affecting this.
This small testapp shows the current X timestamp. I tested a bit more with it,
and it seems the problem exists only with large date changes. Going back or
forth 2 minutes doesn't cause any problem.
Comment 5 Daniel Stone 2007-02-27 01:24:17 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 6 Daniel Stone 2007-04-07 14:55:24 UTC
we now use CLOCK_MONOTONIC where available, in xserver 1.3 and above.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.