From e4a054505f1d584d920d6d1df2c419074de45d05 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 8 May 2024 08:53:19 +0200 Subject: [PATCH] Fix clocks on Windows with Python 3.13 (#8642) 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 6841f4cee9..3013a447c6 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: