diff --git a/dtls_time.c b/dtls_time.c index 5d353b4f..c5db861d 100644 --- a/dtls_time.c +++ b/dtls_time.c @@ -43,12 +43,12 @@ dtls_tick_t dtls_clock_offset; void dtls_clock_init(void) { - dtls_clock_offset = xtimer_now64().ticks64; + dtls_clock_offset = ztimer_now(ZTIMER_MSEC); } void dtls_ticks(dtls_tick_t *t) { - *t = xtimer_now64().ticks64 -dtls_clock_offset; + *t = ztimer_now(ZTIMER_MSEC) - dtls_clock_offset; } #endif /* RIOT_VERSION */ diff --git a/dtls_time.h b/dtls_time.h index 1aafa9a1..a491b0ac 100644 --- a/dtls_time.h +++ b/dtls_time.h @@ -42,15 +42,16 @@ #elif defined(RIOT_VERSION) -#include +#include "ztimer.h" +#include "timex.h" /* this macro is already present on FreeBSD which causes a redefine error otherwise */ #ifndef CLOCK_SECOND -#define CLOCK_SECOND (xtimer_ticks_from_usec64(1000000UL).ticks64) +#define CLOCK_SECOND (MS_PER_SEC) #endif -typedef uint64_t clock_time_t; +typedef uint32_t clock_time_t; #else /* WITH_CONTIKI || RIOT_VERSION */