|
|
|
|
Note that the time can wrap around. On a 32-bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approximately every 72 minutes. |
Well what are you trying to do in the meantime? It burns 100% of the CPU at the moment. Also, your exit condition should be if(timeTest - timeInit >= interval) There's no reason to assume that clock() returns a monotonic +1 value. If the value were to increase by +2 at the wrong moment, you could miss the == test completely. From the manual page. Note that the time can wrap around. On a 32-bit system where CLOCKS_PER_SEC equals 1000000 this function will return the same value approximately every 72 minutes. So you also need to take into account when timeTest < timeInit, and act accordingly. |
|
|