From 00036ea0a3bacb1e935bd608aca0524b17739260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 3 Jul 2025 13:09:50 +0200 Subject: [PATCH 1/2] libc: remove POSIX_TIMERS dep from COMMON_LIBC_TIME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove POSIX_TIMERS dependency from COMMON_LIBC_TIME, as it is no longer needed. Signed-off-by: Fin Maaß --- cmake/toolchain/armclang/Kconfig | 2 +- lib/libc/minimal/Kconfig | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmake/toolchain/armclang/Kconfig b/cmake/toolchain/armclang/Kconfig index 70b9b2bd1520..155da594a924 100644 --- a/cmake/toolchain/armclang/Kconfig +++ b/cmake/toolchain/armclang/Kconfig @@ -16,7 +16,7 @@ choice LIBC_IMPLEMENTATION config ARMCLANG_STD_LIBC bool "ARM Compiler C library" select COMMON_LIBC_STRNLEN - select COMMON_LIBC_TIME if POSIX_TIMERS + select COMMON_LIBC_TIME help Use the full Arm Compiler runtime libraries. A reduced Zephyr minimal libc will be used for library functionality diff --git a/lib/libc/minimal/Kconfig b/lib/libc/minimal/Kconfig index 94737cb81403..ecb0602aaf0d 100644 --- a/lib/libc/minimal/Kconfig +++ b/lib/libc/minimal/Kconfig @@ -37,7 +37,7 @@ config MINIMAL_LIBC_RAND config MINIMAL_LIBC_TIME bool "Time functions" - select COMMON_LIBC_TIME if POSIX_TIMERS + select COMMON_LIBC_TIME select POSIX_C_LANG_SUPPORT_R select COMMON_LIBC_GMTIME_R select COMMON_LIBC_ASCTIME @@ -47,9 +47,6 @@ config MINIMAL_LIBC_TIME help Enable time() and gmtime_r() for the minimal libc. - time() requires CONFIG_POSIX_TIMERS=y because it relies on the POSIX - clock_gettime() function. - In order to make use of the non-reentrant gmtime(), it is necessary to set CONFIG_MINIMAL_LIBC_NON_REENTRANT_FUNCTIONS=y. From 6c89f48068810cdf51c87dcaa7de2b8ff99602e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Thu, 3 Jul 2025 13:11:06 +0200 Subject: [PATCH 2/2] docs: replace clock_gettime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit the time() implementation now uses sys_clock_gettime(), change that in the docs. Signed-off-by: Fin Maaß --- doc/develop/languages/c/common_libc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/develop/languages/c/common_libc.rst b/doc/develop/languages/c/common_libc.rst index 643265a63e18..bceb078f6e10 100644 --- a/doc/develop/languages/c/common_libc.rst +++ b/doc/develop/languages/c/common_libc.rst @@ -12,7 +12,7 @@ Time function ************* This provides an implementation of the standard C function, :c:func:`time`, -relying on the Zephyr function, :c:func:`clock_gettime`. This function can +relying on the Zephyr function, :c:func:`sys_clock_gettime`. This function can be enabled by selecting :kconfig:option:`COMMON_LIBC_TIME`. Dynamic Memory Management