1#define _DEFAULT_SOURCE
2#include "newSleep.h"
3
4void fracSleep(float sec) {
5 struct timespec ts;
6 ts.tv_sec = (int) sec;
7 ts.tv_nsec = (sec - ((int) sec)) * 1000000000;
8 nanosleep(&ts,NULL);
9}
10
11fracSleep(0.5); //Half second delay