use time_monotonic() instead of time() for statistics and time difference calculations

This commit is contained in:
Martin Willi
2009-08-31 18:00:28 +02:00
parent de5784452b
commit 6180a55852
13 changed files with 65 additions and 42 deletions
@@ -1774,7 +1774,16 @@ static status_t query_policy(private_kernel_netlink_ipsec_t *this,
free(out);
return FAILED;
}
*use_time = (time_t)policy->curlft.use_time;
if (policy->curlft.use_time)
{
/* we need the monotonic time, but the kernel returns system time. */
*use_time = time_monotonic(NULL) - (time(NULL) - policy->curlft.use_time);
}
else
{
*use_time = 0;
}
free(out);
return SUCCESS;