aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-29 12:20:21 +0000
committermarha <marha@users.sourceforge.net>2010-12-29 12:20:21 +0000
commit053f5dfd42ade05252e586a282e34906db10828d (patch)
treede215580ce205409a6d810a005c6c5909f3145d1 /xorg-server/os
parent04ceb8c4a0cca3d8682f094d1d6faed8f693afb5 (diff)
parent807c6931fe683fd844ceec1b023232181e6aae03 (diff)
downloadvcxsrv-053f5dfd42ade05252e586a282e34906db10828d.tar.gz
vcxsrv-053f5dfd42ade05252e586a282e34906db10828d.tar.bz2
vcxsrv-053f5dfd42ade05252e586a282e34906db10828d.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/utils.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 9737ced88..5f3054941 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -445,7 +445,21 @@ GetTimeInMillis(void)
#ifdef MONOTONIC_CLOCK
struct timespec tp;
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ static clockid_t clockid;
+ if (!clockid) {
+#ifdef CLOCK_MONOTONIC_COARSE
+ if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
+ (tp.tv_nsec / 1000) <= 1000 &&
+ clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
+ clockid = CLOCK_MONOTONIC_COARSE;
+ else
+#endif
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ clockid = CLOCK_MONOTONIC;
+ else
+ clockid = ~0L;
+ }
+ if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
#endif