Commits

Georg Brandl committed fa2181b

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)

  • Participants
  • Parent commits e938e9e
  • Branches 2.5

Comments (0)

Files changed (1)

Modules/timemodule.c

 		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;
 	}