Check out example codes for "c fractional sleep". It will help you in understanding the concepts better.

Code Example 1

#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

Learn ReactJs, React Native from akashmittal.com