From 6f9d3a15acb743cf35a8a617d89ab8cd4d64e1ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cenk=20G=C3=BCndo=C4=9Fan?= <cnkgndgn@gmail.com>
Date: Fri, 8 Apr 2016 19:53:14 +0200
Subject: [PATCH] gnrc_rpl: reduce scope of now

---
 sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c b/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c
index 6d51ccd2fc..b1b5cc468c 100644
--- a/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c
+++ b/sys/net/gnrc/routing/rpl/gnrc_rpl_dodag.c
@@ -264,11 +264,10 @@ void gnrc_rpl_local_repair(gnrc_rpl_dodag_t *dodag)
 
 void gnrc_rpl_parent_update(gnrc_rpl_dodag_t *dodag, gnrc_rpl_parent_t *parent)
 {
-    uint32_t now = xtimer_now();
-
     /* update Parent lifetime */
     if (parent != NULL) {
-        parent->lifetime = (now / SEC_IN_USEC) + ((dodag->default_lifetime * dodag->lifetime_unit));
+        uint32_t now = xtimer_now();
+        parent->lifetime = (now / SEC_IN_USEC) + (dodag->default_lifetime * dodag->lifetime_unit);
 #ifdef MODULE_GNRC_RPL_P2P
         if (dodag->instance->mop != GNRC_RPL_P2P_MOP) {
 #endif
-- 
GitLab