From 6ac07989b074ab963da911c0ee8b272fd7c1eeb9 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 28 Aug 2024 20:36:51 +0200 Subject: [PATCH] Added link age to link API --- RNS/Link.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RNS/Link.py b/RNS/Link.py index 8df9127..e36e418 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -462,6 +462,15 @@ class Link: def get_context(self): return None + def get_age(self): + """ + :returns: The time in seconds since this link was established. + """ + if self.activated_at: + return time.time() - self.activated_at + else: + return None + def no_inbound_for(self): """ :returns: The time in seconds since last inbound packet on the link. This includes keepalive packets.