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
@@ -1911,9 +1911,16 @@ static status_t query_policy(private_kernel_pfkey_ipsec_t *this,
free(out);
return FAILED;
}
*use_time = response.lft_current->sadb_lifetime_usetime;
/* we need the monotonic time, but the kernel returns system time. */
if (response.lft_current->sadb_lifetime_usetime)
{
*use_time = time_monotonic(NULL) -
(time(NULL) - response.lft_current->sadb_lifetime_usetime);
}
else
{
*use_time = 0;
}
free(out);
return SUCCESS;