#include <iostream>
#include <time.h>
using namespace std;
//usleep function declaration
void usleep(int microseconds);
//usleep function definition
void usleep(int microseconds) // Cross-platform sleep function
{
clock_t time_end;
time_end = clock() + microseconds * CLOCKS_PER_SEC / 1000000; //as 1 microsecond is 1/1000000 of a second.
while (clock() < time_end);
}
int main()
{
cout << "Before calling User defined usleep" << endl;
usleep(4000000);
cout << "After calling User defined usleep" << endl;
}