I had compiled WyldChess for android in the past and had a few problems. I believe I've fixed them but I still have a few doubts.
Take the following code:
Code: Select all
unsigned long long curr_time()
{
static struct timeval curr;
gettimeofday(&curr, 0);
return (curr.tv_sec * 1000 + (curr.tv_usec / 1000.0));
}
Replacing it with the following fixes it on the 2 devices and works well with Windows/Linux too:
Code: Select all
struct timeval start_time;
void init_timer()
{
gettimeofday(&start_time, 0);
}
unsigned long long curr_time()
{
static struct timeval curr;
gettimeofday(&curr, 0);
return ((curr.tv_sec - start_time.tv_sec) * 1000 + ((curr.tv_usec - start_time.tv_usec) / 1000.0));
}
Code: Select all
The gettimeofday() function shall obtain the current time, expressed as
seconds and microseconds since the Epoch, and store it in the timeval
structure pointed to by tp. The resolution of the system clock is
unspecified.