Skip to content

Commit

Permalink
dtls_time: migrate to ztimer_msec
Browse files Browse the repository at this point in the history
  • Loading branch information
fjmolinas committed May 31, 2022
1 parent 4cd793b commit 1c182db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dtls_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
7 changes: 4 additions & 3 deletions dtls_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@

#elif defined(RIOT_VERSION)

#include <xtimer.h>
#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 */

Expand Down

0 comments on commit 1c182db

Please sign in to comment.