From 61f487d75aa1ea186054655eb34072846e64b062 Mon Sep 17 00:00:00 2001 From: scaramallion Date: Sat, 27 Jul 2024 09:57:41 +1000 Subject: [PATCH] Triage 2 --- pynetdicom/tests/test_assoc.py | 11 ++++++----- pynetdicom/utils.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pynetdicom/tests/test_assoc.py b/pynetdicom/tests/test_assoc.py index b761860b4..b52b558b7 100644 --- a/pynetdicom/tests/test_assoc.py +++ b/pynetdicom/tests/test_assoc.py @@ -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 @@ -7590,9 +7591,8 @@ 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 @@ -7600,4 +7600,5 @@ def test_set_timer_resolution(self): 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 diff --git a/pynetdicom/utils.py b/pynetdicom/utils.py index 631ed99c7..743021e12 100644 --- a/pynetdicom/utils.py +++ b/pynetdicom/utils.py @@ -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