pynetdicom.timer.Timer¶
-
class
pynetdicom.timer.
Timer
(timeout)¶ A generic timer.
Implementation of the DICOM Upper Layer’s ARTIM timer. The ARTIM timer is used by the state machine to monitor connection and response timeouts. This class may also be used as a general purpose expiry timer.
A timeout of None implies that expired always returns False and remaining always returns 1. A timeout of float implies that:
- If not yet started, expired returns False and remaining returns timeout
- If started then expired returns False until the time since starting is greater than timeout after which it returns True. remaining returns the number of seconds until expired returns True (will return negative value after expiry)
- If started then stopped before the timeout then expired returns False, if stopped after the time since starting is greater than timeout then returns True. remaining always returns the number of seconds until expired returns True.
References
- DICOM Standard, Part 8, Section 9.1.5.
-
__init__
(timeout)¶ Create a new Timer.
Parameters: timeout (numeric or None) – The number of seconds before the timer expires. A value of None means the timer never expires.
Methods
__init__
(timeout)Create a new Timer. restart
()Restart the timer. start
()Resets and starts the timer running. stop
()Stops the timer and resets it. Attributes
expired
Check if the timer has expired. remaining
Return the number of seconds remaining until timeout. timeout
Return the number of seconds set for timeout. -
expired
¶ Check if the timer has expired.
Returns: True if the timer has expired, False otherwise Return type: bool
-
remaining
¶ Return the number of seconds remaining until timeout.
Returns 1 if the timer is set to never expire.
-
restart
()¶ Restart the timer.
-
start
()¶ Resets and starts the timer running.
-
stop
()¶ Stops the timer and resets it.
-
timeout
¶ Return the number of seconds set for timeout.