mozilla/rust — pull request #11981 by bnoordhuis (2014-02-01 22:51:00+00:00)
Title: Use CLOCK_MONOTONIC_COARSE in libnative on linux.

Or CLOCK_MONOTONIC if CLOCK_MONOTONIC_COARSE isn't available but prefer
CLOCK_MONOTONIC_COARSE. The normal monotonic clock is fetched using a
system call but the coarse clock is read directly from the vDSO and
hence is a lot faster.

Make sure it's high-res enough: it normally has a 1 kHz frequency on
systems tuned for interactivity but on systems that are tuned for
throughput, it may run as slow as 100 Hz.

Whether the normal or the coarse clock is used, it should be an
improvement either way. Before, libnative called gettimeofday() and
that polls a clock that is subject to clock skew.

gettimeofday() is still the time source on the other UNIX platforms,
something that will eventually need to be addressed.