Skip to content

Commit 0b76028

Browse files
committed
fix: tweak
1 parent 35600fe commit 0b76028

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/zeroconf/_dns.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,8 @@ def get_expiration_time(self, percent: _int) -> float:
193193
# TODO: Switch to just int here
194194
def get_remaining_ttl(self, now: _float) -> Union[int, float]:
195195
"""Returns the remaining TTL in seconds."""
196-
remaining = self.created + (_EXPIRE_FULL_TIME_MS * self.ttl) - now
197-
if remaining < 0:
198-
return 0
199-
return remaining / 1000.0
196+
remain = (self.created + (_EXPIRE_FULL_TIME_MS * self.ttl) - now) / 1000.0
197+
return 0 if remain < 0 else remain
200198

201199
def is_expired(self, now: _float) -> bool:
202200
"""Returns true if this record has expired."""

0 commit comments

Comments
 (0)