diff --git a/src/pathfinder/hierarchical.cpp b/src/pathfinder/hierarchical.cpp
index de0b852d1..b350d297b 100644
--- a/src/pathfinder/hierarchical.cpp
+++ b/src/pathfinder/hierarchical.cpp
@@ -14,7 +14,9 @@
 #include "pf_highlevel.h"
 #include "pf_lowlevel.h"
 
+#if defined(DEBUG) && defined(TIMEIT)
 #include "rdtsc.h"
+#endif
 
 struct rect {
 	int Width, Height;
diff --git a/src/pathfinder/pf_low_open.cpp b/src/pathfinder/pf_low_open.cpp
index 83c7f0d14..25b0692dd 100644
--- a/src/pathfinder/pf_low_open.cpp
+++ b/src/pathfinder/pf_low_open.cpp
@@ -5,7 +5,9 @@
 #include <stdlib.h>
 #include "freecraft.h"
 #include "map.h"
+#if defined(DEBUG) && defined(TIMEIT)
 #include "rdtsc.h"
+#endif
 #define PRINTING
 #include "pf_low_open.h"