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
timeoutofNoneimplies thatexpiredalways returnsFalseandremainingalways returns1. Atimeoutoffloatimplies that:If not yet started,
expiredreturnsFalseandremainingreturnstimeoutIf started then
expiredreturnsFalseuntil the time since starting is greater thantimeoutafter which it returnsTrue.remainingreturns the number of seconds untilexpiredreturnsTrue(will return negative value after expiry)If started then stopped before the timeout then
expiredreturnsFalse, if stopped after the time since starting is greater thantimeoutthen returnsTrue.remainingalways returns the number of seconds untilexpiredreturnsTrue.
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
Nonemeans 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:
Trueif the timer has expired,Falseotherwise- Return type: