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

Skip to content

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

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

Closed
Closed
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
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 663809b08cfd895ffad8706d00498d7106428dcd
6 changes: 5 additions & 1 deletion Modules/timemodule.c
83C7
Original file line number Diff line number Diff line change
Expand Up @@ -1509,15 +1509,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