Added link age to link API

This commit is contained in:
Mark Qvist 2024-08-28 20:36:51 +02:00
parent f1d6cda337
commit 6ac07989b0
1 changed files with 9 additions and 0 deletions

View File

@ -462,6 +462,15 @@ class Link:
def get_context(self): def get_context(self):
return None 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): def no_inbound_for(self):
""" """
:returns: The time in seconds since last inbound packet on the link. This includes keepalive packets. :returns: The time in seconds since last inbound packet on the link. This includes keepalive packets.