#include <stdio.h>
#include <time.h>

double last_clock;
double now_time;
double dt;

void delta_time()
{
        last_clock=now_time;
        now_time=clock();
        dt=(double)(now_time-last_clock)/CLOCKS_PER_SEC;
        return;
}

void eat_time()
{
        int x;
        for(x=0;x<5000000;++x)
                x+x/x+x*x+x/x;
        return;
}

int main()
{
        int x;
        clock_t end_time;

        last_clock = now_time = clock();
        end_time=clock() + (10*CLOCKS_PER_SEC);

        while( now_time < end_time )
        {
                eat_time();
                delta_time();
                printf("time delta: %2.5f   FPS: %3.2f  \r", dt, 1/dt);
                fflush(stdout);
        }
        printf("\n");
        return 0;
}
        

WWWOFFLE - Sat, 11 Dec 1999 18:21:41 CET (vor 16 Minuten) - [Löschen| Neu abrufen: Optionen| regelm. abrufen| Index] - WWWOFFLE