One way to resolve conflicting type definition is to selectively enable type definition in FreeRTOS_POSIX_portable_default.h. As an example, please see portable/espressif/esp32_devkitc_esp_wrover_kit/FreeRTOS_POSIX_portable.h. This port is using sys/types.h
provided by third party (line 35 disabled clock_t
definition in FreeRTOS+POSIX, and line 58 included sys/type.h
from system search directory).
This mix-and-match may seem messy. Though, POSIX systems are supposed to follow standard definitions. In this case for sys/types.h
, https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html “clock_t
shall be an integer or real-floating type. time_t
shall be an integer type.” In FreeRTOS+POSIX clock_t
is of type uint32_t
, and could double check that your toolchain type definition can be cast to uint32_t
.
One thing to call out – mix-and-match type definition may be fine (if both systems are following standard definition), additional effort is needed if to mix implementations. In the same example – line 50, we are using third party’s sched.h
definition and also implementation; line 54 using FreeRTOS+POSIX time.h
; …