diff --git a/sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c b/sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c index c1a186da2d89325a79773e428f7e5dd230b1ec53..00717dfee86cf8893bee0867b2bd6ff8c11ba03f 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c +++ b/sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c @@ -18,6 +18,7 @@ #include "mutex.h" #include "net/gnrc/sixlowpan/ctx.h" #include "vtimer.h" +#include "xtimer.h" #define ENABLE_DEBUG (0) #include "debug.h" @@ -132,9 +133,7 @@ gnrc_sixlowpan_ctx_t *gnrc_sixlowpan_ctx_update(uint8_t id, const ipv6_addr_t *p static uint32_t _current_minute(void) { - timex_t now; - vtimer_now(&now); - return now.seconds / 60; + return xtimer_now() / (SEC_IN_USEC * 60); } static void _update_lifetime(uint8_t id) diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c index c785248316768a0e2b7065126b6b4741e7363e8c..61dfb3af3f9945ea2f4407a58e11a50a1249e8a1 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c @@ -231,17 +231,15 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size) static void _rbuf_gc(void) { rbuf_t *oldest = NULL; - timex_t now; + uint32_t now_sec = xtimer_now() / SEC_IN_USEC; unsigned int i; - vtimer_now(&now); - for (i = 0; i < RBUF_SIZE; i++) { if (rbuf[i].pkt == NULL) { /* leave GC early if there is still room */ return; } else if ((rbuf[i].pkt != NULL) && - ((now.seconds - rbuf[i].arrival) > RBUF_TIMEOUT)) { + ((now_sec - rbuf[i].arrival) > RBUF_TIMEOUT)) { DEBUG("6lo rfrag: entry (%s, ", gnrc_netif_addr_to_str(l2addr_str, sizeof(l2addr_str), rbuf[i].src, rbuf[i].src_len)); DEBUG("%s, %u, %u) timed out\n", @@ -269,9 +267,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, size_t size, uint16_t tag) { rbuf_t *res = NULL; - timex_t now; - - vtimer_now(&now); + uint32_t now_sec = xtimer_now() / SEC_IN_USEC; for (unsigned int i = 0; i < RBUF_SIZE; i++) { /* check first if entry already available */ @@ -287,7 +283,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, gnrc_netif_addr_to_str(l2addr_str, sizeof(l2addr_str), rbuf[i].dst, rbuf[i].dst_len), (unsigned)rbuf[i].pkt->size, rbuf[i].tag); - rbuf[i].arrival = now.seconds; + rbuf[i].arrival = now_sec; return &(rbuf[i]); } @@ -306,7 +302,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len, *((uint64_t *)res->pkt->data) = 0; /* clean first few bytes for later * look-ups */ - res->arrival = now.seconds; + res->arrival = now_sec; memcpy(res->src, src, src_len); memcpy(res->dst, dst, dst_len); res->src_len = src_len;