pynetdicom.timer.Timer¶
- class pynetdicom.timer.Timer(timeout: float | None)[source]¶
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
ofNone
implies thatexpired
always returnsFalse
andremaining
always returns1
. Atimeout
offloat
implies that:If not yet started,
expired
returnsFalse
andremaining
returnstimeout
If started then
expired
returnsFalse
until the time since starting is greater thantimeout
after which it returnsTrue
.remaining
returns the number of seconds untilexpired
returnsTrue
(will return negative value after expiry)If started then stopped before the timeout then
expired
returnsFalse
, if stopped after the time since starting is greater thantimeout
then returnsTrue
.remaining
always returns the number of seconds untilexpired
returnsTrue
.
References
DICOM Standard, Part 8, Section 9.1.5.
- __init__(timeout: float | None) None [source]¶
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
Check if the timer has expired.
Return the number of seconds remaining until timeout.
Return the number of seconds set for
timeout
.- property expired: bool¶
Check if the timer has expired.
- Returns:
True
if the timer has expired,False
otherwise- Return type: