Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
61 user(s) are online (42 user(s) are browsing Forums)

Members: 1
Guests: 60

BitBuster, more...

Support us!

Headlines

Report message:*
 

timemeasure function give 0ms ?

Subject: timemeasure function give 0ms ?
by kas1e on 2018/12/5 10:17:18

There is test code:

// ppc-amigaos-g++ -D__USE_OLDTIMEVAL__ test_timemeasuer.c

#include <stdio.h>
#include <proto/dos.h>

unsigned int GetTimeStamp()
{
    
timeval tNow;
    
gettimeofday(&tNowNULL);
    return ((double)
tNow.tv_sec)*1000.0+((double)tNow.tv_usec)/1000.0;
}



int main()
{

int nStartTime=GetTimeStamp();

IDOS->Delay(500);

printf("test time %d ms",GetTimeStamp()-nStartTime);

}


I compile it like

Quote:

ppc-amigaos-g++ -D__USE_OLDTIMEVAL__ test_timemeasuer.c


On running, it wait for some time when Delay() call happens, and then, give me in return 0 ms in printf.

Why ?

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project