Skip to content

Commit

Permalink
Merge pull request #123 from fjmolinas/pr_dtls_time_riot_msec
Browse files Browse the repository at this point in the history
dtls_time: migrate to ztimer_msec
  • Loading branch information
boaks committed Jun 4, 2022
2 parents 98e2cd7 + 1c479d1 commit b3610f5
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 b3610f5

Please sign in to comment.