Skip to content

Commit 8caf665

Browse files
committed
Addressed timeout only working for integer second intervals
1 parent 33dcb6c commit 8caf665

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

XRPLib/timeout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import time
22

33
class Timeout:
4-
def __init__(self, timeout):
4+
def __init__(self, timeout: float):
55
"""
66
Starts a timer that will expire after the given timeout.
77
88
:param timeout: The timeout, in seconds
99
:type timeout: float
1010
"""
11-
self.timeout = timeout
12-
self.start_time = time.time()
11+
self.timeout = timeout*1000
12+
self.start_time = time.ticks_ms()
1313

1414
def is_done(self):
1515
"""
1616
:return: True if the timeout has expired, False otherwise
1717
"""
1818
if self.timeout is None:
1919
return False
20-
return time.time() - self.start_time > self.timeout
20+
return time.ticks_ms() - self.start_time > self.timeout

0 commit comments

Comments
 (0)