Fixed removal of z_impl_clock_gettime in zephyr 3.5.99 (#378)
* Fixed removal of z_impl_clock_gettime in zephyr 3.5.99 Signed-off-by: Daniel Huiskes <d.v.huiskes@student.utwente.nl> * crustify z_impl_clock_gettime fix * single return z_impl_clock_gettime fix --------- Signed-off-by: Daniel Huiskes <d.v.huiskes@student.utwente.nl> Co-authored-by: Daniel Huiskes <d.v.huiskes@student.utwente.nl>
This commit is contained in:
parent
371718ca16
commit
83f129a807
|
@ -7,6 +7,8 @@
|
||||||
#elif defined(UCLIENT_PLATFORM_FREERTOS_PLUS_TCP)
|
#elif defined(UCLIENT_PLATFORM_FREERTOS_PLUS_TCP)
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
#elif defined(UCLIENT_PLATFORM_ZEPHYR)
|
||||||
|
#include <version.h>
|
||||||
#endif /* ifdef WIN32 */
|
#endif /* ifdef WIN32 */
|
||||||
|
|
||||||
//==================================================================
|
//==================================================================
|
||||||
|
@ -53,7 +55,16 @@ int64_t uxr_nanos(
|
||||||
return (( total_tick / (int64_t) portTICK_PERIOD_MS ) * 1000000 );
|
return (( total_tick / (int64_t) portTICK_PERIOD_MS ) * 1000000 );
|
||||||
#elif defined(UCLIENT_PLATFORM_ZEPHYR)
|
#elif defined(UCLIENT_PLATFORM_ZEPHYR)
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
||||||
|
// From Zephyr version 3.5.99 the z_impl_clock_gettime function
|
||||||
|
// has been renamed to the clock_gettime function.
|
||||||
|
// This has been done to implement Zephyr's POSIX API as regular library functions
|
||||||
|
// https://github.com/zephyrproject-rtos/zephyr/commit/95a22b12174621aeba8ca3e0e61f7c66f03202bf
|
||||||
|
#if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(3, 5, 99)
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
#else
|
||||||
z_impl_clock_gettime(CLOCK_REALTIME, &ts);
|
z_impl_clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
#endif /* if ZEPHYR_VERSION_CODE >= ZEPHYR_VERSION(3, 5, 99) */
|
||||||
return (((int64_t)ts.tv_sec) * 1000000000) + ts.tv_nsec;
|
return (((int64_t)ts.tv_sec) * 1000000000) + ts.tv_nsec;
|
||||||
#else
|
#else
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
Loading…
Reference in New Issue