On Mon, Jul 28, 2014 at 01:56:43PM +0000, NiLuJe wrote: > Sure ;). Basically, if CLOCK_MONOTONIC_COARSE isn't supported, it never > falls back to CLOCK_MONOTONIC (AFAICT, that's because the only way to check > the status of syscall() is through errno, not its return value?).
Oh, that's a bit embarassing, it should certainly check errno. > BTW, the clock_source variable isn't terribly useful, since we're using the > constants only once, and only in the clock_gettime call (and I just realized > that the CLOCK_MONOTONIC fallback just uses the constant directly anyway). > > Also, why not ifdef the CLOCK_MONOTONIC_COARSE stuff? If it's not defined, > there's not much chance it'll work at runtime, unless I missed something ;). The Linux headers people are building against often don't match the running kernel, particularly with strange embedded toolchains. So first-time it tests if the running kernel supports CLOCK_MONTONIC_COARSE, then if it doesn't work keeps going with CLOCK_MONOTONIC. That's the intent anyway, I'll fix it and make it also fallback if CLOCK_MONOTONIC fails. Thanks, Matt
