I'm working on a little school project to re-code the SpaceInvaders
Game, without using ncurses
, but only the basic libraries, and i want to use time to print my screen-buffer every time, so i need to know when to print exactly so the user won't feel the screen lagging.
I started using the Clock_t
structure as a test like :
clock_t stime = clock();
sleep(3);
clock_t etime = clock();
unsigned long millis = ((etime - stime) * 1000) / CLOCKS_PER_SEC;
printf("%lu\n",millis);
but the output is 0 all the time, i want know why and how i can fix it so i can see milliseconds, or nanoseconds