Sophie

Sophie

distrib > Fedora > 16 > x86_64 > media > updates-src > by-pkgid > cb9f56216f44bdd97af6eef0bbbd114f > files > 3

csmith-2.1.0-7.fc16.src.rpm

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