net: remove dependency on posix for iso c time() function

The ISO C function time() should not depend on POSIX and this was
corrected recently via the common libc time() implementation.

Remove this dependency from the network subsystem where it has
been unduly needed for some time.

Similarly, XSI_SINGLE_PROCESS was a dependency for time() via
picolibc, because the time() implementation in picolibc relies
on the POSIX gettimeofday() call.

However, since Zephyr's common libc time() implementation no longer
depends on that, it can be removed as a dependency in the network
subsystem as well.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This commit is contained in:
Chris Friedt 2025-05-17 21:37:00 -04:00 committed by Benjamin Cabé
parent 8743da2f32
commit 03db50b79d
3 changed files with 3 additions and 4 deletions

View File

@ -206,7 +206,7 @@ endif # NET_DHCPV6
config NET_CONFIG_CLOCK_SNTP_INIT
bool "Initialize system clock using SNTP on application startup"
depends on SNTP && POSIX_TIMERS
depends on SNTP
help
Perform an SNTP request over networking to get and absolute
wall clock time, and initialize system time from it, so

View File

@ -12,7 +12,6 @@ LOG_MODULE_DECLARE(net_config, CONFIG_NET_CONFIG_LOG_LEVEL);
#include <zephyr/net/net_if.h>
#include <zephyr/net/net_mgmt.h>
#include <zephyr/net/sntp.h>
#include <zephyr/posix/time.h>
#ifdef CONFIG_NET_CONFIG_SNTP_INIT_RESYNC
static void sntp_resync_handler(struct k_work *work);
@ -60,7 +59,7 @@ int net_init_clock_via_sntp(void)
tspec.tv_sec = ts.seconds;
tspec.tv_nsec = ((uint64_t)ts.fraction * (1000 * 1000 * 1000)) >> 32;
res = clock_settime(CLOCK_REALTIME, &tspec);
res = sys_clock_settime(SYS_CLOCK_REALTIME, &tspec);
end:
#ifdef CONFIG_NET_CONFIG_SNTP_INIT_RESYNC

View File

@ -227,7 +227,7 @@ config LWM2M_RD_CLIENT_MAX_RETRIES
config LWM2M_RESOURCE_DATA_CACHE_SUPPORT
bool "Resource Time series data cache support"
depends on (LWM2M_RW_SENML_JSON_SUPPORT || LWM2M_RW_SENML_CBOR_SUPPORT)
depends on (XSI_SINGLE_PROCESS && RING_BUFFER)
depends on RING_BUFFER
help
Enable time series data storage.
Requires time() to provide current Unix timestamp.