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
signature.asc
Description: This is a digitally signed message part
_______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
