c make program sleep milliseconds code example
Example: c fractional sleep
#define _DEFAULT_SOURCE
#include "newSleep.h"
void fracSleep(float sec) {
struct timespec ts;
ts.tv_sec = (int) sec;
ts.tv_nsec = (sec - ((int) sec)) * 1000000000;
nanosleep(&ts,NULL);
}
fracSleep(0.5); //Half second delay