mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
In Windows' time.clock(), when QueryPerformanceFrequency() fails,
the C lib's clock() is used, but it must be divided by CLOCKS_PER_SEC as for the POSIX implementation (thanks to #pypy).
This commit is contained in:
parent
9499b7117a
commit
30712ab82f
1 changed files with 2 additions and 1 deletions
|
|
@ -175,7 +175,8 @@ time_clock(PyObject *self, PyObject *unused)
|
|||
if (!QueryPerformanceFrequency(&freq) || freq.QuadPart == 0) {
|
||||
/* Unlikely to happen - this works on all intel
|
||||
machines at least! Revert to clock() */
|
||||
return PyFloat_FromDouble(clock());
|
||||
return PyFloat_FromDouble(((double)clock()) /
|
||||
CLOCKS_PER_SEC);
|
||||
}
|
||||
divisor = (double)freq.QuadPart;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue