8000 [3.12] gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975) by miss-islington · Pull Request #124073 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975) #124073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975)
Fix OSError for thread_time clock on NetBSD by setting default resolution.
(cherry picked from commit b1d6f8a)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
  • Loading branch information
furkanonder authored and miss-islington committed Sep 13, 2024
commit 3ce379870631af85a83615bd1ca24475da733636
6 changes: 5 additions & 1 deletion Modules/timemodule.c
83D9
Original file line number Diff line number Diff line change
Expand Up @@ -1525,15 +1525,19 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
return -1;
}
if (info) {
struct timespec res;
info->implementation = function;
info->monotonic = 1;
info->adjustable = 0;
#if defined(__NetBSD__)
info->resolution = 1e-9;
#else
struct timespec res;
if (clock_getres(clk_id, &res)) {
PyErr_SetFromErrno(PyExc_OSError);
return -1;
}
info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
#endif
}

if (_PyTime_FromTimespec(tp, &ts) < 0) {
Expand Down
Loading
0