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

Skip to content

Commit b1d6f8a

Browse files
authored
gh-123974: Fix time.get_clock_info() on NetBSD (#123975)
Fix OSError for thread_time clock on NetBSD by setting default resolution.
1 parent ea77973 commit b1d6f8a

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
@@ -1509,15 +1509,19 @@ _PyTime_GetThreadTimeWithInfo(PyTime_t *tp, _Py_clock_info_t *info)
15091509
return -1;
15101510
}
15111511
if (info) {
1512-
struct timespec res;
15131512
info->implementation = function;
15141513
info->monotonic = 1;
15151514
info->adjustable = 0;
1515+
#if defined(__NetBSD__)
1516+
info->resolution = 1e-9;
1517+
#else
1518+
struct timespec res;
15161519
if (clock_getres(clk_id, &res)) {
15171520
PyErr_SetFromErrno(PyExc_OSError);
15181521
return -1;
15191522
}
15201523
info->resolution = res.tv_sec + res.tv_nsec * 1e-9;
1524+
#endif
15211525
}
15221526

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

0 commit comments

Comments
 (0)
0