RE: How to convert the server time in xEvent to system time?

2004-08-11 Thread Marc Aurele La France
On Tue, 10 Aug 2004, Weidong Cui wrote:

 Does anybody know how X computes the time stamp for xEvents?

The Source, Luke.  Use the Source...

  xEvent.u.keyButtonPointer.time (aka 'server time'?), defined
  in X11/Xproto.h, indicates the number of milliseconds elapsed
  since the X server started.  I want to convert it to an

As far as I can tell that's not so.  Instead, this value appears to be the
elapsed time (in milliseconds) since the server system's Epoch, as defined by
its gettimeofday().  Keep in mind, though, that the server system's Epoch is
not necessarily exactly in sync with the client system's Epoch, even if they
both sync to the same time server, unless of course they are both the same
system.  Also, given this is a 32-bit value, it rolls over every 49.71 days.

FWIW, the X server does not keep track of when it was started.

  absolute time which then can be compared with times
  recorded by gettimeofday () in some other program.
  Unfortunately, after spending a lot of time, I still can't
  find out how to do it.  If you happen to know how to do it,
  can you please tell me?

Marc.

+--+---+
|  Marc Aurele La France   |  work:   1-780-492-9310   |
|  Computing and Network Services  |  fax:1-780-492-1729   |
|  352 General Services Building   |  email:  [EMAIL PROTECTED]  |
|  University of Alberta   +---+
|  Edmonton, Alberta   |   |
|  T6G 2H1 | Standard disclaimers apply|
|  CANADA  |   |
+--+---+
XFree86 developer and VP.  ATI driver and X server internals.

___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


Re: How to convert the server time in xEvent to system time?

2004-08-10 Thread Oliver Welter
Am 11.08.2004 00:31:59 schrieb(en) Weidong Cui:
Hi, There,
xEvent.u.keyButtonPointer.time (aka 'server time'?), defined in
X11/Xproto.h, indicates the number of milliseconds elapsed since the  
X
server started.  I want to convert it to an absolute time which  
then
can
be compared with times recorded by gettimeofday () in some other
program.
Unfortunately, after spending a lot of time, I still can't find out
how to
do it.  If you happen to know how to do it, can you please tell me?

Thanks a lot!
Weidong Cui
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

I don't know much about this, but I would suggest, that you use the  
time-function to get the time in seconds.
You divide the number of milliseconds to get seconds and then subtract  
the values.
You get the time of the start of the X-Server in seconds.

Maybe you can use this idea
Oliver Welter
___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel


RE: How to convert the server time in xEvent to system time?

2004-08-10 Thread Weidong Cui
Hi, Oliver,

Thanks a lot for your reply.  I tried this idea before.  But the time of the
start of the X server I got in this way was not accurate enough for my
purpose.

Does anybody know how X computes the time stamp for xEvents?

Thanks,
Weidong Cui

 I don't know much about this, but I would suggest, that you
 use the time-function to get the time in seconds. You divide
 the number of milliseconds to get seconds and then subtract
 the values. You get the time of the start of the X-Server
 in seconds.

 Maybe you can use this idea

 Oliver Welter

 -Original Message-
 From: Weidong Cui [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, August 10, 2004 3:32 PM
 To: [EMAIL PROTECTED]
 Subject: How to convert the server time in xEvent to system time?
 
 
 Hi, There,
 
 xEvent.u.keyButtonPointer.time (aka 'server time'?), defined 
 in X11/Xproto.h, indicates the number of milliseconds elapsed 
 since the X server started.  I want to convert it to an 
 absolute time which then can be compared with times 
 recorded by gettimeofday () in some other program. 
 Unfortunately, after spending a lot of time, I still can't 
 find out how to do it.  If you happen to know how to do it, 
 can you please tell me?
 
 Thanks a lot!
 Weidong Cui
 
 


___
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel