Rémi Denis-Courmont <[email protected]> writes: > Le 2014-09-08 22:20, Gabriel Dume a écrit : >> #if HAVE_CLOCK_GETTIME >> struct timespec ts; >> clock_gettime(CLOCK_MONOTONIC, &ts); >> - return (int64_t)ts.tv_sec * 100000 + ts.tv_nsec / 1000; >> + return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; > > The original code is still wrong by the way. If _POSIX_MONOTONIC_CLOCK > is zero (as on GNU/libc), then availability of the clock needs to be > checked at run-time. Nominally, sysconf(_SC_MONOTONIC_CLOCK) does it.
Wouldn't it be more robust to check the return value of clock_gettime? Should give errno == EINVAL for clocks that aren't available. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
