[PATCH xserver 2/4] os: Use separate clockid for GetTimeInMicros()

Keith Packard keithp at keithp.com
Thu Dec 28 03:38:46 UTC 2017


Jeffrey Smith <whydoubt at gmail.com> writes:

> GetTimeInMillis uses the CLOCK_MONOTONIC_COARSE clock if
> available and the precision is high enough.  That clock is supposed
> to be more efficient to query than CLOCK_MONOTONIC (at the cost
> of being less precise).  So implementing GetTimeInMillis by calling
> GetTimeInMicros could mean spending extra time to get higher
> precision, just to spend more time (for the division) throwing it
> away.

Good point. So, we want to use CLOCK_MONOTONIC_COARSE for Millis and
CLOCK_MONOTONIC for Micros. That seems like a fine plan. I guess what
I'm getting at is that these two functions should return a value in the
same universe at least, so we should either be using the two MONOTONIC
clocks, or we should be using another clock, but we shouldn't be mixing
MONOTONIC and REALTIME clocks?

-- 
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20171227/68d06eaa/attachment.sig>


More information about the xorg-devel mailing list