static PyObject* floattime(_Py_clock_info_t *info) { _PyTime_t t; double d; if (_PyTime_GetSystemClockWithInfo(&t, info) < 0) { assert(info != NULL); return NULL; } d = _PyTime_AsSecondsDouble(t); return PyFloat_FromDouble(d); }
int _PyTime_Init(void) { _PyTime_t t; /* ensure that the system clock works */ if (_PyTime_GetSystemClockWithInfo(&t, NULL) < 0) return -1; /* ensure that the operating system provides a monotonic clock */ if (_PyTime_GetMonotonicClockWithInfo(&t, NULL) < 0) return -1; return 0; }
int _PyTime_Init(void) { _PyTime_t t; /* ensure that the system clock works */ if (_PyTime_GetSystemClockWithInfo(&t, NULL) < 0) return -1; /* ensure that the operating system provides a monotonic clock */ if (_PyTime_GetMonotonicClockWithInfo(&t, NULL) < 0) return -1; /* check that _PyTime_FromSeconds() cannot overflow */ assert(INT_MAX <= _PyTime_MAX / SEC_TO_NS); assert(INT_MIN >= _PyTime_MIN / SEC_TO_NS); return 0; }