about XSync extension problem.

lantian ai ailantian at googlemail.com
Tue Nov 17 17:32:48 PST 2009


Hello Ajax :

Sorry ,an update here

I need to use this command compile the test programme. it is ok.

ailantian at vax:~/mypg$ arm-ThunderST-linux-gnueabi-gcc clock.c -o clock -lrt


Thanks

Best regards

ailantian

2009/11/18 lantian ai <ailantian at googlemail.com>:
> Hello ajax:
>
> Thanks for your help .
>
> That is the reason. I checked the configure log, My cross toolchain
> don't support this function.
>
> ailantian at vax:~/stuff/workspace/work/armv7a-ThunderST-linux-gnueabi/xserver-xorg-2_1.6.2-r1/xorg-server-1.6.2$
> grep MONOTONIC_CLOCK * -R
> autom4te.cache/output.0:  MONOTONIC_CLOCK="cross compiling"
> autom4te.cache/output.0:  MONOTONIC_CLOCK=yes
> autom4te.cache/output.0:MONOTONIC_CLOCK=no
> autom4te.cache/output.0:    MONOTONIC_CLOCK=no
> autom4te.cache/output.0:{ echo "$as_me:$LINENO: result: $MONOTONIC_CLOCK" >&5
> autom4te.cache/output.0:echo "${ECHO_T}$MONOTONIC_CLOCK" >&6; }
> autom4te.cache/output.0:if test "x$MONOTONIC_CLOCK" = xyes; then
> autom4te.cache/output.0:@%:@define MONOTONIC_CLOCK 1
> autom4te.cache/output.1:  MONOTONIC_CLOCK="cross compiling"
> autom4te.cache/output.1:  MONOTONIC_CLOCK=yes
> autom4te.cache/output.1:MONOTONIC_CLOCK=no
> autom4te.cache/output.1:    MONOTONIC_CLOCK=no
> autom4te.cache/output.1:{ echo "$as_me:$LINENO: result: $MONOTONIC_CLOCK" >&5
> autom4te.cache/output.1:echo "${ECHO_T}$MONOTONIC_CLOCK" >&6; }
> autom4te.cache/output.1:if test "x$MONOTONIC_CLOCK" = xyes; then
> autom4te.cache/output.1:@%:@define MONOTONIC_CLOCK 1
> autom4te.cache/output.2:  MONOTONIC_CLOCK="cross compiling"
> autom4te.cache/output.2:  MONOTONIC_CLOCK=yes
> autom4te.cache/output.2:MONOTONIC_CLOCK=no
> autom4te.cache/output.2:    MONOTONIC_CLOCK=no
> autom4te.cache/output.2:{ echo "$as_me:$LINENO: result: $MONOTONIC_CLOCK" >&5
> autom4te.cache/output.2:echo "${ECHO_T}$MONOTONIC_CLOCK" >&6; }
> autom4te.cache/output.2:if test "x$MONOTONIC_CLOCK" = xyes; then
> autom4te.cache/output.2:@%:@define MONOTONIC_CLOCK 1
> autom4te.cache/traces.0:m4trace:configure.ac:771: -1-
> m4_pattern_allow([^MONOTONIC_CLOCK$])
> autom4te.cache/traces.1:m4trace:configure.ac:771: -1-
> AC_DEFINE_TRACE_LITERAL([MONOTONIC_CLOCK])
> autom4te.cache/traces.1:m4trace:configure.ac:771: -1-
> m4_pattern_allow([^MONOTONIC_CLOCK$])
> autom4te.cache/traces.1:m4trace:configure.ac:771: -1-
> AH_OUTPUT([MONOTONIC_CLOCK], [/* Have monotonic clock from
> clock_gettime() */
> autom4te.cache/traces.1:#undef MONOTONIC_CLOCK])
> autom4te.cache/traces.2:m4trace:configure.ac:771: -1-
> AC_DEFINE_TRACE_LITERAL([MONOTONIC_CLOCK])
> autom4te.cache/traces.2:m4trace:configure.ac:771: -1-
> m4_pattern_allow([^MONOTONIC_CLOCK$])
> autom4te.cache/traces.2:m4trace:configure.ac:771: -1-
> AH_OUTPUT([MONOTONIC_CLOCK], [/* Have monotonic clock from
> clock_gettime() */
> autom4te.cache/traces.2:#undef MONOTONIC_CLOCK])
> configure:  MONOTONIC_CLOCK="cross compiling"
> configure:  MONOTONIC_CLOCK=yes
> configure:MONOTONIC_CLOCK=no
> configure:    MONOTONIC_CLOCK=no
> configure:{ echo "$as_me:$LINENO: result: $MONOTONIC_CLOCK" >&5
> configure:echo "${ECHO_T}$MONOTONIC_CLOCK" >&6; }
> configure:if test "x$MONOTONIC_CLOCK" = xyes; then
> configure:#define MONOTONIC_CLOCK 1
> configure.ac:    ], [MONOTONIC_CLOCK=yes], [MONOTONIC_CLOCK=no],
> configure.ac:       [MONOTONIC_CLOCK="cross compiling"])
> configure.ac:    MONOTONIC_CLOCK=no
> configure.ac:AC_MSG_RESULT([$MONOTONIC_CLOCK])
> configure.ac:if test "x$MONOTONIC_CLOCK" = xyes; then
> configure.ac:    AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock
> from clock_gettime()])
> cscope.out:MONOTONIC_CLOCK
> cscope.out:     m_SC_MONOTONIC_CLOCK
> cscope.out:     #_SC_MONOTONIC_CLOCK
> cscope.out:_SC_MONOTONIC_CLOCK
> cscope.out:     #_POSIX_MONOTONIC_CLOCK
> Binary file hw/vfb/.libs/Xvfb matches
> Binary file hw/kdrive/sdl/.libs/Xsdl matches
> Binary file hw/kdrive/ephyr/.libs/Xephyr matches
> Binary file hw/xfree86/.libs/Xorg matches
> include/dix-config.h:/* #undef MONOTONIC_CLOCK */
> include/do-not-use-config.h.in:#undef MONOTONIC_CLOCK
> include/do-not-use-config.h.in~:#undef MONOTONIC_CLOCK
> include/do-not-use-config.h:/* #undef MONOTONIC_CLOCK */
> include/dix-config.h.in:#undef MONOTONIC_CLOCK
> Binary file os/.libs/libos.a matches
> Binary file os/.libs/xstrans.o matches
> Binary file os/.libs/connection.o matches
> os/utils.c:#ifdef MONOTONIC_CLOCK
>
>
> I tried the programme in configure scripts
>
> #include <time.h>
>
> int main(int argc, char *argv[]) {
>    struct timespec tp;
>
>    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
>        return 0;
>    else
>        return 1;
> }
>
>
> ailantian at vax:~/mypg$ export PATH=$PATH:~/stuff/workspace/cross/armv7a/bin/
> ailantian at vax:~/mypg$ arm-ThunderST-linux-gnueabi-gcc clock.c -o clock
> /tmp/ccqZa0a0.o: In function `main':
> clock.c:(.text+0x20): undefined reference to `clock_gettime'
> collect2: ld returned 1 exit status
> ailantian at vax:~/mypg$
>
>
> Thanks very much.
>
> Could I do some work to fix this problem?
>
> My Xorg is using gettimeofday  now, so when I change time, XSync will fail.
>
> Thanks
>
> Best regards
>
> ailantian
>
> 2009/11/18 Adam Jackson <ajax at nwnk.net>:
>> On Tue, 2009-11-17 at 10:21 +0800, lantian ai wrote:
>>
>>> _X_EXPORT CARD32
>>> GetTimeInMillis(void)
>>> {
>>>    struct timeval tv;
>>>
>>> #ifdef MONOTONIC_CLOCK
>>>    struct timespec tp;
>>>    if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
>>>        return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
>>> #endif
>>>
>>>    X_GETTIMEOFDAY(&tv);
>>>    return(tv.tv_sec * 1000) + (tv.tv_usec / 1000);
>>> }
>>>
>>> May be on desktop  we use clock_gettime, on arm we use gettimeofday.
>>>
>>> But when we change the time , both will change? isn't it?
>>
>> If we were using clock_gettime(CLOCK_REALTIME), then changes to the
>> system date and time would affect us, same as with gettimeofday().  This
>> is in fact the _entire_ reason that we use CLOCK_MONOTONIC instead; X's
>> internal notion of time is related to elapsed time, and not to whatever
>> the user happened to set the date to.
>>
>> - ajax
>>
>



More information about the xorg mailing list