lib: posix: Fix undefined reference to clock_gettime()

timespec_to_timeoutms calls clock_gettime that requires
CONFIG_POSIX_CLOCK. ifdef this function to avoid undefined reference.

Fixes #20137

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2020-02-25 16:06:23 -08:00 committed by Johan Hedberg
commit 9e45c67679

View file

@ -9,6 +9,7 @@
#include <wait_q.h>
#include <posix/time.h>
#ifdef CONFIG_POSIX_CLOCK
s64_t timespec_to_timeoutms(const struct timespec *abstime)
{
s64_t milli_secs, secs, nsecs;
@ -30,3 +31,4 @@ s64_t timespec_to_timeoutms(const struct timespec *abstime)
return milli_secs;
}
#endif /* CONFIG_POSIX_CLOCK */