Mail Archives: djgpp/1997/02/05/16:09:22
Hi,
I have tested the following program both in MS-DOS and Windows (3.11).
In DOS
it works well but in Windows 'dt' variable gets frequently negative
values.
Can some one tell me why this happens and is there any way to fix it?
#include <iostream.h>
#include <time.h>
void main (void)
{
uclock_t t0 = uclock (), t;
long dt;
for (long i = 0; i < 100; i++) {
t = uclock ();
dt = t - t0;
cout << " t0=" << (long) t0 << " t=" << (long) t << " dt=" << dt <<
endl;
t0 = t;
}
}
Timo DOT Saarinen AT uku DOT fi
- Raw text -