[libav-devel] [PATCH] time: Add missing zero

Niels Möller nisse at lysator.liu.se
Tue Sep 9 12:43:31 CEST 2014


Rémi Denis-Courmont <remi at remlab.net> writes:

> Le 2014-09-09 10:48, nisse at lysator.liu.se a écrit :
>> Wouldn't it be more robust to check the return value of
>> clock_gettime?
>> Should give errno == EINVAL for clocks that aren't available.
>
> Why would it be more robust?

Because you can generate some suitable error message if the clock is
missing due to some misconfiguration or other error. Always checking
return values is a bit annoying, but it's usually the right thing to do.

> Also, you really want to probe the clock once and use the same result
> always.

You could check the return value for every call, and stop using it if it
fails (which clearly will be the first call, in any normal situation).

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the libav-devel mailing list