Skip to content

Instantly share code, notes, and snippets.

@TheCodeEngine
Last active December 16, 2015 17:49
Show Gist options
  • Save TheCodeEngine/5473215 to your computer and use it in GitHub Desktop.
Save TheCodeEngine/5473215 to your computer and use it in GitHub Desktop.
Wait three seconds
fprintf(stdout, "run chat server ...\n");
struct timespec t = { 3/*seconds*/, 0/*nanoseconds*/};
int count = 0;
while ( count < 3 )
{
printf("Wait three seconds and...\n");
nanosleep(&t,NULL);
fflush(stdout); //see below
count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment