8000 [3.12] gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975) (#1… · python/cpython@b2a7d71 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2a7d71

Browse files
[3.12] gh-123974: Fix time.get_clock_info() on NetBSD (GH-123975) (#124073)
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>
1 parent 84e3f60 commit b2a7d71

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/timemodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,15 +1525,19 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
15251525
return -1;
15261526
}
15271527
if (info) {
1528-
struct timespec res;
15291528
info->implementation = function;
15301529
info->monotonic = 1;
15311530
info->adjustable = 0;
1531+
#if defined(__NetBSD__)
1532+
info->resolution = 1e-9;
1533+
#else
1534+
struct timespec res;
15321535
if (clock_getres(clk_id, &res)) {
15331536
PyErr_SetFromErrno(PyExc_OSError);
15341537
return -1;
15351538
}
15361539
info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
1540+
#endif
15371541
}
15381542

15391543
if (_PyTime_FromTimespec(tp, &ts) < 0) {

0 commit comments

Comments
 (0)
0