Skip to content

Commit 0eb00c4

Browse files
committed
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 <[email protected]>
1 parent 5f2c480 commit 0eb00c4

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

subsys/net/lib/config/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ endif # NET_DHCPV6
206206

207207
config NET_CONFIG_CLOCK_SNTP_INIT
208208
bool "Initialize system clock using SNTP on application startup"
209-
depends on SNTP && POSIX_TIMERS
209+
depends on SNTP
210210
help
211211
Perform an SNTP request over networking to get and absolute
212212
wall clock time, and initialize system time from it, so

subsys/net/lib/config/init_clock_sntp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ LOG_MODULE_DECLARE(net_config, CONFIG_NET_CONFIG_LOG_LEVEL);
1212
#include <zephyr/net/net_if.h>
1313
#include <zephyr/net/net_mgmt.h>
1414
#include <zephyr/net/sntp.h>
15-
#include <zephyr/posix/time.h>
1615

1716
#ifdef CONFIG_NET_CONFIG_SNTP_INIT_RESYNC
1817
static void sntp_resync_handler(struct k_work *work);
@@ -60,7 +59,7 @@ int net_init_clock_via_sntp(void)
6059

6160
tspec.tv_sec = ts.seconds;
6261
tspec.tv_nsec = ((uint64_t)ts.fraction * (1000 * 1000 * 1000)) >> 32;
63-
res = clock_settime(CLOCK_REALTIME, &tspec);
62+
res = k_clock_settime(K_CLOCK_REALTIME, &tspec);
6463

6564
end:
6665
#ifdef CONFIG_NET_CONFIG_SNTP_INIT_RESYNC

subsys/net/lib/lwm2m/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ config LWM2M_RD_CLIENT_MAX_RETRIES
227227
config LWM2M_RESOURCE_DATA_CACHE_SUPPORT
228228
bool "Resource Time series data cache support"
229229
depends on (LWM2M_RW_SENML_JSON_SUPPORT || LWM2M_RW_SENML_CBOR_SUPPORT)
230-
depends on (XSI_SINGLE_PROCESS && RING_BUFFER)
230+
depends on RING_BUFFER
231231
help
232232
Enable time series data storage.
233233
Requires time() to provide current Unix timestamp.

0 commit comments

Comments
 (0)