docstring

This commit is contained in:
Will McGugan
2022-12-30 14:51:05 +00:00
parent efa16e2ab0
commit 619ba5f2fd

View File

@@ -12,8 +12,18 @@ CREATE_WAITABLE_TIMER_HIGH_RESOLUTION = 0x00000002
def sleep(sleep_for: float) -> None:
"""A replacement sleep for Windows.
Python 3.11 added a more accurate sleep. This may be used on < Python 3.11
Args:
sleep_for (float): Seconds to sleep for.
"""
handle = kernel32.CreateWaitableTimerExW(
None, None, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, 0x1F0003
None,
None,
CREATE_WAITABLE_TIMER_HIGH_RESOLUTION,
0x1F0003,
)
if not handle:
time_sleep(sleep_for)