aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/plugins/kernel_netlink
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-31 17:59:00 +0200
committerMartin Willi <martin@strongswan.org>2009-08-31 18:00:28 +0200
commit6180a55852afaf7fee4086a45dccbff9d7f7dfa8 (patch)
tree61968edccb4b5b5e39a045b16067299f1e5cda02 /src/charon/plugins/kernel_netlink
parentde5784452b31af3c7342269127a12d352edc0b4e (diff)
downloadstrongswan-6180a55852afaf7fee4086a45dccbff9d7f7dfa8.tar.bz2
strongswan-6180a55852afaf7fee4086a45dccbff9d7f7dfa8.tar.xz
use time_monotonic() instead of time() for statistics and time difference calculations
Diffstat (limited to 'src/charon/plugins/kernel_netlink')
-rw-r--r--src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
index 63a968371..edad7f700 100644
--- a/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
+++ b/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
@@ -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;