Skip to content

Commit

Permalink
Triage 2
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion committed Jul 26, 2024
1 parent 37dbb37 commit 61f487d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions pynetdicom/tests/test_assoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7572,11 +7572,12 @@ def test_no_ctypes(self):
def test_set_timer_resolution(self):
"""Test setting the windows timer resolution works."""
min_val, max_val, pre_timer = self.get_timer_info()
print("Initial", min_val, max_val, pre_timer)
# print("Initial", min_val, max_val, pre_timer)
# Initial 5000 156250 156250
# Set the timer resolution to the current plus 10%
# e.g. (5000 -> 5500) * 100 ns
# Set in terms of ms
pynetdicom._config.WINDOWS_TIMER_RESOLUTION = pre_timer * 1.10 / 10000
pynetdicom._config.WINDOWS_TIMER_RESOLUTION = min_val * 1.10 / 10000

self.ae = ae = AE()
ae.acse_timeout = 5
Expand All @@ -7590,14 +7591,14 @@ def test_set_timer_resolution(self):
assoc = ae.associate("localhost", 11112)

min_val, max_val, during_timer = self.get_timer_info()
print("During", min_val, max_val, during_timer)
# e.g. 5500 > 5000
assert during_timer > pre_timer
# e.g. 5500 < 156250
assert during_timer < pre_timer
assoc.release()
assert assoc.is_released

scp.shutdown()

min_val, max_val, post_timer = self.get_timer_info()
print("Post", min_val, max_val, post_timer)
# e.g. 5000 < 5500
assert post_timer < during_timer
2 changes: 1 addition & 1 deletion pynetdicom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def set_timer_resolution(resolution: Optional[float]) -> Iterator[None]:
yield None

# Reset the timer resolution
dll.NtSetTimerResolution(resolution, 0, ctypes.byref(current))
dll.NtSetTimerResolution(current, 1, ctypes.byref(current))
else:
yield None

Expand Down

0 comments on commit 61f487d

Please sign in to comment.