Search
 
SCRIPT & CODE EXAMPLE
 

C

c sleep milliseconds

#include <time.h>
#include <errno.h>    

/* msleep(): Sleep for the requested number of milliseconds. */
int msleep(long msec)
{
    struct timespec ts;
    int res;

    if (msec < 0)
    {
        errno = EINVAL;
        return -1;
    }

    ts.tv_sec = msec / 1000;
    ts.tv_nsec = (msec % 1000) * 1000000;

    do {
        res = nanosleep(&ts, &ts);
    } while (res && errno == EINTR);

    return res;
}
Comment

PREVIOUS NEXT
Code Example
C :: c int to char 
C :: double array in c 
C :: how to open a file with open in c 
C :: what is the usage of extern in c 
C :: isspace 
C :: addition of two numbers in c 
C :: Bitwise Operators in C/C++ 
C :: inputting an array in c 
C :: fwrite in c 
C :: why there is return 0 used in c 
C :: typedef vs #define 
C :: c typedef 
C :: sort names in array in c 
C :: read file c 
C :: actionbar content color in android 
C :: passing file as argument in c 
C :: include ‘<stdlib.h’ or provide a declaration of ‘exit’ 
C :: powershell search big files 
C :: arduino empty serial buffer 
C :: strstr 
C :: print the name of a file c 
C :: C float and double Output 
C :: C Syntax of goto Statement 
C :: linux_reboot_magic2 
C :: do a barrel roll 
C :: How can you invoke the constructor from the parent class? *ruby 
C :: how to find folders from a c program 
C :: Computers round off numbers 
C :: reading arrays from stdin c 
C :: float para numeros aleatorios em c 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =