1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/native: Use ztimer instead of xtimer

This commit is contained in:
MrKevinWeiss 2023-03-06 12:03:26 +01:00
parent bc517b5c47
commit 66570cb0fb
No known key found for this signature in database
GPG Key ID: 4B69974722CBEEAE
4 changed files with 9 additions and 11 deletions

View File

@ -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

View File

@ -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 <ludwig.knuepfer@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de>

View File

@ -31,7 +31,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#ifdef MODULE_XTIMER
#ifdef MODULE_LIBC_GETTIMEOFDAY
#include <sys/time.h>
#endif
#include <ifaddrs.h>
@ -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;

View File

@ -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"