Skip to content

Commit

Permalink
Fix Windows timer resolution not resetting after Association release (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion authored Jul 27, 2024
1 parent 1d0b1df commit 09d7405
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pynetdicom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def set_timer_resolution(resolution: Optional[float]) -> Iterator[None]:
dll.NtQueryTimerResolution(
ctypes.byref(maximum), ctypes.byref(minimum), ctypes.byref(current)
)
original = current.value

# Make sure the desired resolution is in the valid range
# Timer resolution is in 100 ns units -> 10,000 == 1 ms
Expand All @@ -307,8 +308,9 @@ def set_timer_resolution(resolution: Optional[float]) -> Iterator[None]:

yield None

# Reset the timer resolution
dll.NtSetTimerResolution(resolution, 0, ctypes.byref(current))
# Reset the timer resolution to the original
dll.NtSetTimerResolution(original, 1, ctypes.byref(current))

else:
yield None

Expand Down

0 comments on commit 09d7405

Please sign in to comment.