Patch for Co:Z Target System Toolkit when building from source

General discussion of the Co:Z Toolkit
Post Reply
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Patch for Co:Z Target System Toolkit when building from source

Post by coz »

The Co:Z Target System Toolkit will not build from source correctly on some newer Linux versions. If you are attempting to build from source, and encounter an error similar to:

Code: Select all

ElapsedTime.h:60:7: error: missing binary operator before token "1000000"
   #if CLOCKS_PER_SEC >= 1000000
       ^
You will need to apply the following patch. This fix will be included in the next release. NOTE: The binary versions of the Target System Toolkit are not affected by this problem.

Code: Select all

diff -u -r1.10 ElapsedTime.h
--- src/client/c/unix/ElapsedTime.h	4 May 2015 18:18:10 -0000	1.10
+++ src/client/c/unix/ElapsedTime.h	22 Sep 2016 14:06:59 -0000
@@ -56,11 +56,7 @@
 
 		now -= start_clock;
 		lap_cpu.tv_sec = now / CLOCKS_PER_SEC;
-		#if CLOCKS_PER_SEC >= 1000000
-			lap_cpu.tv_usec = (now % CLOCKS_PER_SEC) / (CLOCKS_PER_SEC / 1000000);
-		#else
-			lap_cpu.tv_usec = (now % CLOCKS_PER_SEC) * (1000000 / CLOCKS_PER_SEC);
-		#endif
+		lap_cpu.tv_usec = now % CLOCKS_PER_SEC;
 	}
 	
 	void stop() {
@@ -72,11 +68,7 @@
 
 		now -= start_clock;
 		lap_cpu.tv_sec = now / CLOCKS_PER_SEC;
-		#if CLOCKS_PER_SEC >= 1000000
-			lap_cpu.tv_usec = (now % CLOCKS_PER_SEC) / (CLOCKS_PER_SEC / 1000000);
-		#else
-			lap_cpu.tv_usec = (now % CLOCKS_PER_SEC) * (1000000 / CLOCKS_PER_SEC);
-		#endif
+		lap_cpu.tv_usec = now % CLOCKS_PER_SEC;
 		add(cumm_cpu, lap_cpu);
 	}
 	
Post Reply