Skip to content
Snippets Groups Projects
Commit 0aad35f3 authored by Christian Mehlis's avatar Christian Mehlis
Browse files

ccnl: normalize time before using it

parent 5bc873d8
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment