At 14.18 2005.02.28 +0000, you wrote: >One possibility: the windows kernel thread scheduler works with a >"clock" of 10ms. If your thread is pre-empted (ie, switched out of >context), you will not get another time slice for at least 10ms. you can lower it to 1ms if you make this WINMM.DLL call: timeBeginPeriod(1); and when you're finished: timeEndPeriod(1); >Consequently, all of the windows Wait* fuctions, which typically take a >millisecond timespan as an argument, will not time to a resolution lower >than 10ms. In fact, your wait call will happen on a multiple of 10ms. >Over longer waits, and a lot of repeated waits, the effect tends to >average out. > >You can test this easily with simple C++ code that fires a timer >callback every 1 ms. If you use the QueryPerformanceCounter (and also >QueryPerformanceFrequency), and write out the timespan since the last >call, you'll see that despite the fact that you asked for 1ms, you get >10 or 0, seemingly at random. A function like this will demonstrate:- Even better use the Pentium+ TSC (Time Stamp Counter) register.. Greets, TPM -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist