#include <sys/time.h>
static double now_ms(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec*1000. + tv.tv_usec/1000.;
}
windows
static double now_ms(void)
{
static LARGE_INTEGER frequency;
static bool dummy = QueryPerformanceFrequency(&frequency);
LARGE_INTEGER count;
QueryPerformanceCounter(&count);
if(frequency.QuadPart == 0) return 0;
return (double)count.QuadPart/(double)frequency.QuadPart;
}