C 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

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools