Accurate time measurement
I am running a program with a loop, and this loop is dependent on the speed of the computer or whatever. i.e.
and I want to know when .25 of a second (250 milliseconds) has passed, without using sleep. Using the return value of time(NULL); is hopeless as that seems to count in seconds. Any suggestions?
18 mS resolution with Sindows???
I could be wrong... I'm at work and all my books are at home... If your code works ignore this!!!!
1- I seem to remember that (with MS windows) the tick only gets updated every 18mS. So, even though the result is in milliseconds, it does not have 1mS resolution.
2- Your in a multitasking envoronment. What happens if the OS is off doing something else at the moment your program wants to check the time? Don't you have to do "something" to make sure your program has 100% control of the CPU during this critical time?
We have an EPROM/FLASH programmer here that runs from a DOS program. When I asked the manufacturer why there was no Windows software, they said "because we can't control the timing". Their windows product has a clock built into the hardware. (In fact, we run the thing in a DOS window we don't have any problems.)