pynetdicom.timer.Timer

class pynetdicom.timer.Timer(max_number_seconds)[source][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.

References

  • DICOM Standard, Part 8, Section 9.1.5.
__init__(max_number_seconds)[source][source]

Create a new Timer.

Parameters:max_number_seconds (int or float or None) – The number of seconds before the timer expires. A value of None means no timeout.

Methods

__init__(max_number_seconds) Create a new Timer.
restart() Restart the timer.
start() Resets and starts the timer running.
stop() Stops the timer and resets it.

Attributes

is_expired Check if the timer has expired.
time_remaining Return the number of seconds remaining until timeout.
timeout_seconds Return the number of seconds set for timeout.
is_expired

Check if the timer has expired.

Returns:True if the timer has expired, False otherwise
Return type:bool
restart()[source][source]

Restart the timer.

If the timer has already started then stop it, reset it and start it. If the timer isn’t running then reset it and start it.

start()[source][source]

Resets and starts the timer running.

stop()[source][source]

Stops the timer and resets it.

time_remaining

Return the number of seconds remaining until timeout.

Returns -1 if the timer is set to unlimited timeout.

timeout_seconds

Return the number of seconds set for timeout.