From the example I gave you, I think its more efficient to do this:
Code:
#include <time.h>
#include <stdio.h>
int main(void)
{
clock_t ticks1, ticks2;
ticks1 = clock();
ticks2 = ticks1;
while( ticks2 - ticks1 < CLOCKS_PER_SEC)
ticks2=clock();
printf("Took %ld ticks to wait one second. ticks2 = %ld, ticks1 = %ld\n",ticks2 - ticks1, ticks2, ticks1);
printf("This value should be the same as CLOCKS_PER_SEC which is %ld.\n",CLOCKS_PER_SEC);
return 0;
}
This way, you'll be sure that the while loop will take exactly 1 second if ticks1 is some other random, relatively big number like 264.