about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--include/afl-fuzz.h26
-rw-r--r--include/common.h28
-rw-r--r--src/afl-gotcpu.c14
3 files changed, 29 insertions, 39 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index 693e0dc6..d5ad4653 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -858,32 +858,6 @@ static u64 next_p2(u64 val) {
 
 }
 
-/* Get unix time in milliseconds */
-
-static u64 get_cur_time(void) {
-
-  struct timeval  tv;
-  struct timezone tz;
-
-  gettimeofday(&tv, &tz);
-
-  return (tv.tv_sec * 1000ULL) + (tv.tv_usec / 1000);
-
-}
-
-/* Get unix time in microseconds */
-
-static u64 get_cur_time_us(void) {
-
-  struct timeval  tv;
-  struct timezone tz;
-
-  gettimeofday(&tv, &tz);
-
-  return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
-
-}
-
 #ifdef _AFL_DOCUMENT_MUTATIONS
 extern u8  do_document;
 extern u32 document_counter;
diff --git a/include/common.h b/include/common.h
index ad1f81fb..0d7f4f0b 100644
--- a/include/common.h
+++ b/include/common.h
@@ -25,6 +25,8 @@
 
 #ifndef __AFLCOMMON_H
 #define __AFLCOMMON_H
+
+#include <sys/time.h>
 #include "types.h"
 
 extern u8* target_path;                 /* Path to target binary            */
@@ -37,3 +39,29 @@ char** get_wine_argv(u8* own_loc, char** argv, int argc);
 char*  get_afl_env(char* env);
 #endif
 
+/* Get unix time in milliseconds */
+
+static u64 get_cur_time(void) {
+
+  struct timeval  tv;
+  struct timezone tz;
+
+  gettimeofday(&tv, &tz);
+
+  return (tv.tv_sec * 1000ULL) + (tv.tv_usec / 1000);
+
+}
+
+/* Get unix time in microseconds */
+
+static u64 get_cur_time_us(void) {
+
+  struct timeval  tv;
+  struct timezone tz;
+
+  gettimeofday(&tv, &tz);
+
+  return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
+
+}
+
diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c
index 214862a9..31455b66 100644
--- a/src/afl-gotcpu.c
+++ b/src/afl-gotcpu.c
@@ -51,6 +51,7 @@
 
 #include "types.h"
 #include "debug.h"
+#include "common.h"
 
 #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
     defined(__APPLE__) || defined(__DragonFly__)
@@ -72,19 +73,6 @@
 #endif
 #endif               /* __linux__ || __FreeBSD__ || __NetBSD__ || __APPLE__ */
 
-/* Get unix time in microseconds. */
-
-static u64 get_cur_time_us(void) {
-
-  struct timeval  tv;
-  struct timezone tz;
-
-  gettimeofday(&tv, &tz);
-
-  return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
-
-}
-
 /* Get CPU usage in microseconds. */
 
 static u64 get_cpu_usage_us(void) {