diff mbox series

[05/12] net: lwip: use timer_early_get_count() when CONFIG_SANDBOX_TIMER=y

Message ID 20250314215525.579655-6-jerome.forissier@linaro.org
State New
Headers show
Series lwIP sandbox tests | expand

Commit Message

Jerome Forissier March 14, 2025, 9:55 p.m. UTC
When the sandbox timer is available, use it. This allows skipping
time in the tests (sandbox_eth_skip_timeout()).

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
---
 net/lwip/net-lwip.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/net/lwip/net-lwip.c b/net/lwip/net-lwip.c
index 5d862e038a9..c20bdaf8086 100644
--- a/net/lwip/net-lwip.c
+++ b/net/lwip/net-lwip.c
@@ -14,6 +14,7 @@ 
 #include <lwip/init.h>
 #include <lwip/prot/etharp.h>
 #include <net.h>
+#include <timer.h>
 
 /* xx:xx:xx:xx:xx:xx\0 */
 #define MAC_ADDR_STRLEN 18
@@ -339,7 +340,11 @@  int net_loop(enum proto_t protocol)
 
 u32_t sys_now(void)
 {
+#if CONFIG_IS_ENABLED(SANDBOX_TIMER)
+	return timer_early_get_count();
+#else
 	return get_timer(0);
+#endif
 }
 
 int net_start_again(void)