On Wed, Dec 27, 2017 at 1:26 PM, Keith Packard <[email protected]> wrote:
> Jeff Smith <[email protected]> writes:
>
>> Prior to commit a779fda2 (xwayland: Use the CLOCK_MONOTONIC clock),
>> GetTimeInMillis() and GetTimeInMicros() had separate clockid's.  As a
>> part of making them available to ForceClockId(), that commit replaced
>> them with a single clockid, whose value depended on which GetTime
>> function got called first.
>
> Hrm. I would think that it would be good to have both paths always
> select the same clock; is there some reason we can't have
> GetTimeInMillis just call GetTimeInMicros and divide by 1000?

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.

> I think the only reason for prefering milliseconds is that it's easier
> on 32-bit hardware, yes?

The X base protocol and Xlib use millisecond granularity, and
GetTimeInMillis is used in updating the xserver's global currentTime
value which also uses millisecond granularity.

> --
> -keith
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to