From 0aad35f33c7fc203bc714b46b5f2c697e151f707 Mon Sep 17 00:00:00 2001
From: Christian Mehlis <mehlis@inf.fu-berlin.de>
Date: Wed, 7 May 2014 18:13:26 +0200
Subject: [PATCH] ccnl: normalize time before using it

---
 sys/net/ccn_lite/ccnl-core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sys/net/ccn_lite/ccnl-core.c b/sys/net/ccn_lite/ccnl-core.c
index add04a7557..6f78b298f8 100644
--- a/sys/net/ccn_lite/ccnl-core.c
+++ b/sys/net/ccn_lite/ccnl-core.c
@@ -1143,9 +1143,12 @@ ccnl_forward_remove(struct ccnl_relay_s *ccnl, struct ccnl_forward_s *fwd)
     return fwd2;
 }
 
-bool ccnl_is_timeouted(struct timeval *now, struct timeval *last_used, time_t timeout_s, time_t timeout_us)
+bool ccnl_is_timeouted(struct timeval *now, struct timeval *last_used, uint32_t timeout_s, uint32_t timeout_us)
 {
-    struct timeval abs_timeout = { last_used->tv_sec + timeout_s, last_used->tv_usec + timeout_us };
+
+    timex_t time = timex_set(timeout_s, timeout_us);
+    timex_normalize(&time);
+    struct timeval abs_timeout = { last_used->tv_sec + time.seconds, last_used->tv_usec + time.microseconds };
     return timevaldelta(now, &abs_timeout) > 0;
 }
 
-- 
GitLab