Subject: Re: Compiling gnuchess under gnu-win32 [Solution]
From: [email-masked] (Mumit Khan)

6 Jan 1999 02:28:40 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: Kent Perrier <[email-masked]>
Cc: "[email-masked]" <[email-masked]>

Kent Perrier <[email-masked]> writes:
> Kent Perrier wrote:
> > 
> > Has anyone compiled gnuchess under gnu-win32?  After I modified the
> > makefile to look in /usr/local/include (so it can find curses.h)
> > everything compiles fine until it comes to gnuan.c
> > I get these two errors:
> > 
> > ./gnuan.c: In function 'InputCommand':
> > ./gnuan.c:1727: too few arguments to function `difftime'
> > make: *** [gnuan.o] Error 1
> > /home/gnuchess-4.0pl79/src$

Gnuchess is using some non-standard version of difftime! The real
fix is to fix gnuchess.

>    elapsed_time = difftime(end_time - start_time);
>    fprintf (fpout, "\n           Elapsed time was %ld seconds.\n",

This is not the definition of ANSI difftime. Unless ANSI has changed
from my copy (I don't have a c9x handy here):

      difftime()        Return the difference in seconds between two
                        calendar times: time1 - time0.

Note the *two* arguments.

Cygwin difftime works just fine. Try the following code (it should print 
something close to 5.0). 

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

  int main () {
    time_t time0, time1;
    double delta_t;
    time0 = time (0);
    
    sleep (5);
    
    time1 = time (0);
    
    delta_t = difftime (time1, time0);
    printf ("delta time = %f\n", delta_t);
    return 0;
  }

$ gcc -Wall -o difftime difftime.c
$ ./difftime
delta time = 5.000000

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".