summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-29 12:42:07 +0000
committerGeorg Brandl <georg@python.org>2007-03-29 12:42:07 +0000
commitc606e05dccfeb9d2dea1e387cc9032a371373a07 (patch)
treec80e0290b0afbab9e72e1d55355ba0f86d37a9d3
parent69377f35d44c187a07db0ccfeec94df0e24572df (diff)
downloadcpython-c606e05dccfeb9d2dea1e387cc9032a371373a07.tar.gz
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).
-rw-r--r--Modules/timemodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 9ab2724738..4f562c78e9 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -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;
}