Skip to content
Search

C:sleep

lastmod 2018-08-17created 2014-02-165 edits

Suspend execution for an interval of time. That is, it suspends the thread for a set amount of time.

SYNOPSIS

#include <unistd.h>
unsigned int sleep(unsigned int seconds);

Windows version

The UNIX version of sleep is in seconds, but the Windows API is in milliseconds. You can handle this difference as shown below.

#ifdef __unix__
# include <unistd.h>
#elif defined _WIN32
# include <windows.h>
# define sleep(x) Sleep(1000 * x)
#endif

See also

Favorite site