#include <stdio.h>
#include <time.h>
#include <sys/time.h>
struct timeval t1, t2;
double delta_time()
{
double dt;
gettimeofday(&t1,NULL);
dt=(t2.tv_sec-t1.tv_sec)+(t2.tv_usec-t1.tv_usec)/1000000.0;
gettimeofday(&t2,NULL);
return -dt;
}
void waste_time()
{
int x;
for(x=0;x<5000000;++x)
x+x/x+x*x+x/x;
return;
}
int main()
{
double dt=.0001;
while(1)
{
waste_time ();
dt=delta_time();
printf("time delta: %2.5f FPS: %3.2f \r", dt, 1.0/dt);
fflush(0);
}
return 0;
}
WWWOFFLE - Sat, 11 Dec 1999 18:22:00 CET (vor 15 Minuten) - [Löschen| Neu abrufen: Optionen| regelm. abrufen| Index] - WWWOFFLE