[NCS 3.2.0] missing include in sdk-zephyr/os/lib/clock.c

Hi,

in https://github.com/nrfconnect/sdk-zephyr/blob/ncs-v3.2.0/lib/os/clock.c i think an include to properly resolve CLOCK_REALTIME or 

CLOCK_MONOTONIC is missing, if you try, for example, to use one of that  define in that file (e.g, like printing) they are not resolved.
In my case CLOCK_REALTIME is used.
 
As temporray fix i have added:
#include <zephyr/posix/time.h>
and resolve the issue, but i do not know if there is the correct file, since- i suppose- that define is toolchain-dependent.
 
You can replicate the issue bye selecting:
CONFIG_POSIX_TIMERS=y
and use 
clock_settime/clock_gettime with CLOCK_REALTIME, they return -EINVAL because does not map the above defines.
In NCS 3.1.1 there is no such problem because the implementation is simpler without the mapping introduced by the new file https://github.com/nrfconnect/sdk-zephyr/blob/ncs-v3.2.0/lib/os/clock.c
The reason of the creation of that file i think is to get the rid of posix api and have something equivalnet to get/set time.
This is the commit that caused the problem: https://github.com/nrfconnect/sdk-zephyr/commit/4b9081698270e7976c940f43ed62b948adb547d2 - i suppose: try to add mapping function between clock-id defined by toolchain and sys-clock-id.
Thank you,
Alessandro
Related