Why is the sleep-time of Sleep(1) seems to be variable in Windows?
问题 Last week I needed to test some different algorithmic functions and to make it easy to myself I added some artifical sleeps and simply measured the clock time. Something like this: start = clock(); for (int i=0;i<10000;++i) { ... Sleep(1); ... } end = clock(); Since the argument of Sleep is expressed in milliseconds I expected a total wall clock time of about 10 seconds (a big higher because of the algorithms but that's not important now), and that was indeed my result. This morning I had to