[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gettimeofday() broken in MiNTLib?
When I compile the gettimeofday() code at the bottom, only timeval
struct member tv_sec changes and in step of two!!! The interval seems
to be about one second so it's also bogus besides not being updated
at 200hz interval as I would have thought. This throws off my W Jewel
game timing a 'bit'...
I got MiNTlibs PL46 and otherwise they seem to work just perfectly.
Do you got any clues to what might be wrong?
- Eero
-----
#include <sys/time.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
long until_sec, until_usec;
struct timezone tzp;
struct timeval now;
gettimeofday(&now, &tzp);
until_sec = now.tv_sec;
until_usec = now.tv_usec;
do
{
gettimeofday(&now, &tzp);
} while(now.tv_sec == until_sec && now.tv_usec == until_usec);
printf("%ld, %ld -> %ld, %ld\n",
until_sec, until_usec,
now.tv_sec, now.tv_usec);
return 0;
}