Skip to content

Commit da854bb

Browse files
committed
tests/net/gnrc_mac_timeout: migrate to ztimer
1 parent 46787e9 commit da854bb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include ../Makefile.net_common
22

3+
USEMODULE += ztimer_msec
34
USEMODULE += gnrc_mac
45

56
include $(RIOTBASE)/Makefile.include

tests/net/gnrc_mac_timeout/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "net/gnrc/mac/timeout.h"
2424
#include "thread.h"
2525
#include "msg.h"
26-
#include "xtimer.h"
26+
#include "ztimer.h"
2727

2828
#define TIMEOUT_COUNT 3
2929
#define TIMEOUT_1_DURATION 1000
@@ -34,7 +34,7 @@ static gnrc_mac_timeout_event_t test_timeouts[TIMEOUT_COUNT];
3434
static gnrc_mac_timeout_type_t timeout_1;
3535
static gnrc_mac_timeout_type_t timeout_2;
3636
static gnrc_mac_timeout_type_t timeout_3;
37-
static uint32_t start_time;
37+
static ztimer_now_t start_time;
3838

3939
static char worker_stack[THREAD_STACKSIZE_MAIN];
4040

@@ -47,10 +47,10 @@ void *worker_thread(void *arg)
4747

4848
while (1) {
4949
msg_t m;
50-
uint32_t now;
50+
ztimer_now_t now;
5151

5252
msg_receive(&m);
53-
now = xtimer_now_usec() / US_PER_MS;
53+
now = ztimer_now(ZTIMER_MSEC);
5454

5555
if (gnrc_mac_timeout_is_expired(&mac_timeout, timeout_1)) {
5656
printf("At %6" PRIu32 " ms received msg %i: timeout_1 (set at %" PRIu32 " ms) expired, "
@@ -102,7 +102,7 @@ int main(void)
102102
timeout_2 = -2;
103103
timeout_3 = -3;
104104

105-
start_time = xtimer_now_usec() / US_PER_MS;
105+
start_time = ztimer_now(ZTIMER_MSEC);
106106
gnrc_mac_init_timeouts(&mac_timeout, test_timeouts, TIMEOUT_COUNT);
107107
gnrc_mac_set_timeout(&mac_timeout, timeout_1, TIMEOUT_1_DURATION, pid);
108108
gnrc_mac_set_timeout(&mac_timeout, timeout_2, TIMEOUT_2_DURATION, pid);

0 commit comments

Comments
 (0)