Using Xlib, can we query the current X server time? With that I mean the value that would be returned in the time
field of an XEvent
if we were to receive an event right now.
Preferably without opening any windows.
Maybe this is what you was searching for:
The only system counter that is guaranteed to be present is called SERVERTIME, which counts milliseconds from some arbitrary starting point. The least significant 32 bits of this counter track the value of Time used by the server in Events and Requests. Other system counters may be provided by different implementations of the extension. The X Consortium will maintain a registry of system counter names to avoid collisions in the name space.
The approach suggested by Andreas is also recommended by the ICCCM specification:
Clients attempting to acquire a selection must set the time value of the
SetSelectionOwner
request to the timestamp of the event triggering the acquisition attempt, not toCurrentTime
. A zero-length append to a property is a way to obtain a timestamp for this purpose; the timestamp is in the correspondingPropertyNotify
event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With