8000 gh-123974: Fix OSError for thread_time clock on NetBSD by setting default resolution by furkanonder · Pull Request #123975 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-123974: Fix OSError for thread_time clock on NetBSD by setting default resolution #123975

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 3 commits into from
Sep 13, 2024
Merged
Changes from 1 commit
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
8000
Diff view
Diff view
Next Next commit
Fix OSError for thread_time clock on NetBSD by setting default resolu…
…tion
  • Loading branch information
furkanonder committed Sep 11, 2024
commit 57a4f92590f7e5c5c1eeec6f8e15eb96be0fba8b
6 changes: 5 additions & 1 deletion Modules/timemodule.c
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-8;
#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