[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: os.clock() does not return CPU time on Windows
- From: Rob Kendrick <rjek@...>
- Date: Fri, 8 Nov 2019 13:27:46 +0000
On Thu, Nov 07, 2019 at 02:22:46PM -0300, Roberto Ierusalimschy wrote:
> > But it appears that on Windows the C function clock()
> > returns wall-time instead of CPU-time:
> > https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/clock?view=vs-2019
> > [...]
> > It looks like it's Microsoft's fault
> > to incorrectly implement C run-time function.
> "It looks like" is an euphemism. They explicitly say that the function
> is incorrect:
> Note that this function does not strictly conform to ISO C, which
> specifies net CPU time as the return value.
Does it give the rationale? I have always assumed this is a backwards
compability issue (which Microsoft take very seriously): under DOS the
the wall clock time a program had been running was identical to its use
of the CPU, as it was a single-tasking environment.