diff --git a/src/call_out.c b/src/call_out.c
index 142c3cfe1a61f4c797c2ff6fb36e6ff60ed2a651..3cf365e999c6a99500255902e7a1ee6ee42323f0 100644
--- a/src/call_out.c
+++ b/src/call_out.c
@@ -1,3 +1,4 @@
+#include <sys/types.h>
 #include <stdio.h>
 #include "global.h"
 #include "array.h"
diff --git a/src/main.c b/src/main.c
index 643d10cf6d4ac2220c91cc634d527749995341bf..173ef6eec36d52e71808d4f11e24b1ecb8bab9fb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,6 +2,9 @@
 #include <stdlib.h>
 #include "global.h"
 #include "types.h"
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 #include "backend.h"
 #include "module.h"
 #include "object.h"
@@ -18,9 +21,6 @@
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
 #endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
 #ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #endif