Skip to content

Instantly share code, notes, and snippets.

@uhziel
Created April 12, 2012 04:13
Show Gist options
  • Save uhziel/2364556 to your computer and use it in GitHub Desktop.
Save uhziel/2364556 to your computer and use it in GitHub Desktop.
#include<time.h>
#include<stdio.h>
int main(void)
{
clock_t ticks1, ticks2;
ticks1=clock();
ticks2=ticks1;
while((ticks2-ticks1)/CLOCKS_PER_SEC<1) {
ticks2=clock();
}
printf("Took %ld ticks to wait one second.\n",ticks2-ticks1);
printf("This value should be the same as CLOCKS_PER_SEC which is %ld.\n",CLOCKS_PER_SEC);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment