Skip to content

Commit cc7f81e

Browse files
authored
Use high resolution timer on Windows (hardbyte#1449)
* use high resolution timer * enable CI for feature branches
1 parent 9f5af3f commit cc7f81e

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [ published ]
66
pull_request:
77
push:
8-
branches: [ develop, main ]
8+
99
env:
1010
PY_COLORS: "1"
1111

can/broadcastmanager.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,15 @@ def __init__(
248248

249249
if HAS_EVENTS:
250250
self.period_ms = int(round(period * 1000, 0))
251-
self.event = win32event.CreateWaitableTimer(None, False, None)
251+
try:
252+
self.event = win32event.CreateWaitableTimerEx(
253+
None,
254+
None,
255+
win32event.CREATE_WAITABLE_TIMER_HIGH_RESOLUTION,
256+
win32event.TIMER_ALL_ACCESS,
257+
)
258+
except (AttributeError, OSError):
259+
self.event = win32event.CreateWaitableTimer(None, False, None)
252260

253261
self.start()
254262

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"setuptools",
9393
"wrapt~=1.10",
9494
"typing_extensions>=3.10.0.0",
95-
'pywin32;platform_system=="Windows" and platform_python_implementation=="CPython"',
95+
'pywin32>=305;platform_system=="Windows" and platform_python_implementation=="CPython"',
9696
'msgpack~=1.0.0;platform_system!="Windows"',
9797
"packaging",
9898
],

0 commit comments

Comments
 (0)