diff --git a/cpu/native/Makefile.dep b/cpu/native/Makefile.dep index d4f8360d63..7fb477b19e 100644 --- a/cpu/native/Makefile.dep +++ b/cpu/native/Makefile.dep @@ -41,11 +41,7 @@ ifneq (,$(filter socket_zep,$(USEMODULE))) endif ifneq (,$(filter libc_gettimeofday,$(USEMODULE))) - USEMODULE += xtimer - ifneq (,$(filter ztimer_xtimer_compat,$(USEMODULE))) - # requires 64bit timestamps - USEMODULE += ztimer64_xtimer_compat - endif + USEMODULE += ztimer64_usec endif USEMODULE += periph diff --git a/cpu/native/periph/timer.c b/cpu/native/periph/timer.c index 546012f7bd..d0c27b1130 100644 --- a/cpu/native/periph/timer.c +++ b/cpu/native/periph/timer.c @@ -18,7 +18,7 @@ * Uses POSIX realtime clock and POSIX itimer to mimic hardware. * * This is based on native's hwtimer implementation by Ludwig Knüpfer. - * I removed the multiplexing, as xtimer does the same. (kaspar) + * I removed the multiplexing, as ztimer does the same. (kaspar) * * @author Ludwig Knüpfer * @author Kaspar Schleiser diff --git a/cpu/native/syscalls.c b/cpu/native/syscalls.c index 9108b1d6b1..2840824f14 100644 --- a/cpu/native/syscalls.c +++ b/cpu/native/syscalls.c @@ -31,7 +31,7 @@ #include #include #include -#ifdef MODULE_XTIMER +#ifdef MODULE_LIBC_GETTIMEOFDAY #include #endif #include @@ -39,7 +39,10 @@ #include "cpu.h" #include "irq.h" -#include "xtimer.h" +#ifdef MODULE_LIBC_GETTIMEOFDAY +#include "time_units.h" +#include "ztimer64.h" +#endif #include "stdio_base.h" #include "kernel_defines.h" @@ -485,7 +488,7 @@ int getpid(void) int _gettimeofday(struct timeval *tp, void *restrict tzp) { (void)tzp; - uint64_t now = xtimer_now_usec64(); + uint64_t now = ztimer64_now(ZTIMER64_USEC); tp->tv_sec = now / US_PER_SEC; tp->tv_usec = now - tp->tv_sec; return 0; diff --git a/sys/Kconfig b/sys/Kconfig index 5eb6789c69..2de4c83e50 100644 --- a/sys/Kconfig +++ b/sys/Kconfig @@ -57,8 +57,7 @@ endchoice config MODULE_LIBC_GETTIMEOFDAY bool "Support for gettimeofday()" - select MODULE_XTIMER - select MODULE_ZTIMER64_XTIMER_COMPAT if MODULE_ZTIMER_XTIMER_COMPAT + select ZTIMER64_USEC rsource "Kconfig.newlib" rsource "Kconfig.picolibc"