aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/timers.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/timers.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/timers.h b/src/timers.h
index 6c67a6a..5a691c8 100644
--- a/src/timers.h
+++ b/src/timers.h
@@ -19,4 +19,9 @@ void timers_handshake_complete(struct wireguard_peer *peer);
void timers_session_derived(struct wireguard_peer *peer);
void timers_any_authenticated_packet_traversal(struct wireguard_peer *peer);
+static inline bool has_expired(ktime_t birthday, u64 expiration_seconds)
+{
+ return !ktime_after(ktime_add_ns(birthday, expiration_seconds * NSEC_PER_SEC), ktime_get_boottime());
+}
+
#endif /* _WG_TIMERS_H */