From 3cd4078ef50fc1b58d748c9171d160ebab1ea9bd Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:10:45 +0200 Subject: [PATCH 1/2] Fix resolution of process_time and thread_time --- Modules/timemodule.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 3271d87ddc27f2..182957d5711078 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -1307,7 +1307,7 @@ py_process_time(time_module_state *state, PyTime_t *tp, if (info) { info->implementation = "GetProcessTimes()"; - info->resolution = 1e-7; + info->resolution = 15.625e-3; info->monotonic = 1; info->adjustable = 0; } @@ -1468,7 +1468,7 @@ _PyTime_GetThreadTimeWithInfo(PyTime_t *tp, _Py_clock_info_t *info) if (info) { info->implementation = "GetThreadTimes()"; - info->resolution = 1e-7; + info->resolution = 15.625e-3; info->monotonic = 1; info->adjustable = 0; } From 04b64e128ee7898ffc68685f69b85f4f6ad4336b Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:34:31 +0200 Subject: [PATCH 2/2] add news --- .../next/Library/2025-06-09-17-33-49.gh-issue-135304.GN747s.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2025-06-09-17-33-49.gh-issue-135304.GN747s.rst diff --git a/Misc/NEWS.d/next/Library/2025-06-09-17-33-49.gh-issue-135304.GN747s.rst b/Misc/NEWS.d/next/Library/2025-06-09-17-33-49.gh-issue-135304.GN747s.rst new file mode 100644 index 00000000000000..10aa10c1bb6eed --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-06-09-17-33-49.gh-issue-135304.GN747s.rst @@ -0,0 +1,2 @@ +Fix reported resolution of :func:`time.process_time` and +:func:`time.thread_time` on Windows. Patch by Chris Eibl.