On Fri, 2010-08-27 at 10:21 +0800, Yaakov (Cygwin/X) wrote: > On Fri, 2010-08-27 at 09:20 +0800, Zhao Yakui wrote: > > diff --git a/os/utils.c b/os/utils.c > > index 51455cc..a37a99d 100644 > > --- a/os/utils.c > > +++ b/os/utils.c > > @@ -427,7 +427,17 @@ GetTimeInMillis(void) > > > > #ifdef MONOTONIC_CLOCK > > struct timespec tp; > > - if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) > > + static clockid_t clockid; > > + if (!clockid) { > > +#if defined(__linux__) && defined(CLOCK_MONONOTIC_COARSE) > > s/MONONOTIC/MONOTONIC/
Thanks for the catching. Sorry for the typo. > > But shouldn't that just be #ifdef CLOCK_MONOTONIC_COARSE? What if > another system besides Linux implements it? I am not sure whether this should be applied on other platform. In fact I limit it to linux platform based on the discussion of V1 version(the coarse monotonic posix timer is supported on the latest linux kernel). > > > + if ((clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0) && > > + (tp.tv_nsec / 1000 <= 1000)) > > + clockid = CLOCK_MONOTONIC_COARSE; > > + else > > +#endif > > + clockid = CLOCK_MONOTONIC; > > + } > > + if (clock_gettime(clockid, &tp) == 0) > > return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L); > > #endif > > > > > Yaakov > Cygwin/X > > > _______________________________________________ > xorg-devel@lists.x.org: X.Org development > Archives: http://lists.x.org/archives/xorg-devel > Info: http://lists.x.org/mailman/listinfo/xorg-devel _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel