xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jan 30 21:08:05 UTC 2019
os/utils.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 937a5b78a2f6ea771132ff0f9ece708a23c1bdad
Author: Peter Harris <pharris at opentext.com>
Date: Wed Jan 30 14:51:07 2019 -0500
os: Fix GetTimeInMicros resolution
GetTimeInMillis is called first, which sets clockid to
CLOCK_MONOTONIC_COARSE, which is typically much lower resolution than
the callers of GetTimeInMicros want.
Prior to a779fda224bee0c4d27636503367e55ae93b33c2, GetTimeInMillis and
GetTimeInMicros did not share a clockid.
Restore the clockid split to fix the granularity of GetTimeInMicros.
Signed-off-by: Peter Harris <pharris at opentext.com>
diff --git a/os/utils.c b/os/utils.c
index 17ad22ca2..f04bf8045 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -485,14 +485,15 @@ GetTimeInMicros(void)
struct timeval tv;
#ifdef MONOTONIC_CLOCK
struct timespec tp;
+ static clockid_t uclockid;
- if (!clockid) {
+ if (!uclockid) {
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
- clockid = CLOCK_MONOTONIC;
+ uclockid = CLOCK_MONOTONIC;
else
- clockid = ~0L;
+ uclockid = ~0L;
}
- if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
+ if (uclockid != ~0L && clock_gettime(uclockid, &tp) == 0)
return (CARD64) tp.tv_sec * (CARD64)1000000 + tp.tv_nsec / 1000;
#endif
More information about the xorg-commit
mailing list