#ifndef CLOCKS_PER_SEC
#include <time.h>
#endif

/* although mingw has struct timeval defined in winsock.h, don't bother to
   include it (winsock's select does not work with anything but sockets anyway) */

struct timeval {
        long    tv_sec;
        long    tv_usec;
};

/* this is a quick hack stolen from rdi-share/hostchan.c */
static void gettimeofday( struct timeval *time_now, void *dummy )
{
        time_t t = clock();
        time_now->tv_sec = t/CLOCKS_PER_SEC;
        time_now->tv_usec = (t%CLOCKS_PER_SEC)*(1000000/CLOCKS_PER_SEC);
}
