Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
C :: nested switch case in c 
C :: reverse of a string in c 
C :: printf type format 
C :: copy string c 
C :: armstrong number in c 
C :: c check if character is a digit 
C :: arduino millis 
C :: write array of char to file in c 
C :: Graphics in C Draw A Line 
C :: install tweaks ubuntu 
C :: dynamic memory in c 
C :: convert int to string c 
C :: copy string in c 
C :: c radians 
C :: prime number c program 
C :: replacing a character in string in C 
C :: c functions example 
C :: bash get load average 
C :: int to double c 
C :: gcd and lcd in c 
C :: print float number completely in C language 
C :: hourglass sum 
C :: how to change file permissions in C language 
C :: definir função em c 
C :: rust set toolchain 
C :: armstrong in c 
C :: c calling a function 
C :: predefined macros 
C :: c to assembly converter 
C :: retoure a la ligne C 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =