
7 May
2007
7 May
'07
12:23 a.m.
On 5/1/07, Philippe Vaucher <philippe.vaucher@gmail.com> wrote:
The reason is simple: clock() times CPU time. usleep() sleeps - it doesn't use the CPU. Thus, no "time" elapses during the sleep.
Makes sense, but on windows it works even when I Sleep() so it confused me a bit. [snip]
Standard clock() measures CPU time, while Windows / MS DOS clock() measures elapsed time. Most of us could use the old boost timer otherwise. Moreover, Windows 95/98/ME did not provide alternative API to measure CPU time. NT based Windows became dominant only recently; otherwise the problem would be fixed long ago.