From f10c398e26d622ea72d04739744173a3e8784bb4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 7 May 2024 19:07:03 +0200 Subject: [PATCH] Fix clocks on Windows with Python 3.13 Closes #8641. _WindowsTime is no longer needed on Windows with Python 3.13. On Windows, Python 3.13 now uses GetSystemTimePreciseAsFileTime() for time.time() and QueryPerformanceCounter() for time.monotonic(). * https://github.com/python/cpython/pull/116781 * https://github.com/python/cpython/pull/116822 --- distributed/metrics.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/distributed/metrics.py b/distributed/metrics.py index 6841f4cee99..3013a447c6f 100755 --- a/distributed/metrics.py +++ b/distributed/metrics.py @@ -2,6 +2,7 @@ import asyncio import collections +import sys import threading import time as timemod from collections.abc import Callable, Hashable, Iterator @@ -93,7 +94,7 @@ def resync(self) -> None: # A high-resolution wall clock timer measuring the seconds since Unix epoch -if WINDOWS: +if WINDOWS and sys.version_info < (3, 13): time = _WindowsTime(timemod.time, is_monotonic=False).time monotonic = _WindowsTime(timemod.monotonic, is_monotonic=True).time else: