problem with my time code
It prints same values for in all the loop.
and it doesn't add properly new_time.time and new_time.millitm
meaning,
when I print them separately , their value added together doesnt match up with last_time.
Please help me , where am I going wrong :((
Code:
void time()
{
struct timeb new_time;
double last_time,latest_time, interval_time = 0, real_interval_time;
ftime(&new_time); //init purpose
last_time =(double)new_time.time+(double)(new_time.millitm * 0.001 );
printf("last_time=%lf\n",last_time);
while(1)
{
ftime(&new_time);
latest_time=(double)new_time.time+(double)(new_time.millitm * 0.001);
printf("latest_time=%lf\t",latest_time);
real_interval_time = latest_time - last_time;
printf("rit=%lf\t",real_interval_time);
interval_time += real_interval_time;
printf("it=%lf\n",interval_time);
last_time = latest_time;
}
}