1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

sixlowpan: use xtimer_now() instead of vtimer_now()

This commit is contained in:
Cenk Gündoğan 2015-10-28 21:07:27 +01:00
parent 023c0984b3
commit 3b825c2523
2 changed files with 7 additions and 12 deletions

View File

@ -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)

View File

@ -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;