[Python-checkins] r54607 - python/branches/release25-maint/Modules/timemodule.c

georg.brandl python-checkins at python.org
Thu Mar 29 14:42:17 CEST 2007


Author: georg.brandl
Date: Thu Mar 29 14:42:16 2007
New Revision: 54607
Modified:
 python/branches/release25-maint/Modules/timemodule.c
Log:
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).
 (backport from rev. 54606)
Modified: python/branches/release25-maint/Modules/timemodule.c
==============================================================================
--- python/branches/release25-maint/Modules/timemodule.c	(original)
+++ python/branches/release25-maint/Modules/timemodule.c	Thu Mar 29 14:42:16 2007
@@ -175,7 +175,8 @@
 		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;
 	}


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /