Could you perhaps explain what needs to be timed and why? Making input into a time puzzle isn't very user friendly, or fun, even if this is some sort of game. Some people just think or type slow.
Still you can measure the difference between some time earlier and after they input quite simply though it isn't precise:
Code:
#include <stdio.h>
#include <time.h>
int main (void)
{
double diff = 0.0;
time_t start;
time_t stop;
char buff[128];
printf("Quick! Input!!!\n");
time(&start);
if (fgets(buff, sizeof buff, stdin) != NULL) {
time(&stop);
diff = difftime(stop, start);
printf("%s\n", buff);
printf("It took you %g seconds to type that\n", diff);
}
return 0;
}
If you just need to know the performance of your program, measuring the time yourself isn't accurate, but a profiler could help you.