diff -up csmith-2.1.0/src/platform.cpp.secondary csmith-2.1.0/src/platform.cpp --- csmith-2.1.0/src/platform.cpp.secondary 2012-12-06 11:06:11.000000000 +0100 +++ csmith-2.1.0/src/platform.cpp 2012-12-06 11:16:41.000000000 +0100 @@ -39,8 +39,9 @@ // --------------------------------------- // Platform-Specific code to get a unique seed value (usually from the tick counter, etc) // +#include <stdlib.h> #include <sys/types.h> -#include <sys/timeb.h> +#include <sys/time.h> #include "platform.h" @@ -71,6 +72,7 @@ static unsigned __int64 read_time(void) return (h << 32) + l ; } #else +#if defined(__x86_64__) || defined(__i386__) static long long read_time(void) { long long l; asm volatile( "rdtsc\n\t" @@ -78,6 +80,15 @@ static long long read_time(void) { ); return l; } +#else +/* fallback using gettimeofday() */ +static unsigned long long read_time(void) { + struct timeval tv; + + gettimeofday(&tv, NULL); + return tv.tv_sec * 1000000 + tv.tv_usec; +} +#endif #endif #endif