implement time delay in c

In standard C (C99), you can use time() to do this, something like: #include <time.h> : void waitFor (unsigned int secs) { unsigned int retTime = time(0) + secs; // Get finishing time. while (time(0) < retTime); // Loop until it arrives. } By the way, this assumes time() returns a 1-second resolution value. I … Read more