Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

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
 
PREVIOUS NEXT
Tagged: #fractional #sleep
ADD COMMENT
Topic
Name
1+7 =