I have a simple C app that uses constant 50%. I don\'t know why but I like to minimize it as much as possible.
#include
#include
Your loop:
while (clock() < endwait) {}
is busy-waiting. You are basically having the following conversation with the CPU.
"Are we there yet?" "No."
"Are we there yet?" "No."
"Are we there yet?" "No."
(repeat several gazillion times)
"Are we there yet?" "Yes."
You are better off using a function like sleep()
which tells the CPU to tell you when it's ready.