diff --git a/report.c b/report.c
index 9c77755..a4f0db1 100644
--- a/report.c
+++ b/report.c
@@ -37,7 +37,6 @@ static const char rcsid[] __attribute__((unused)) =
 #include <sys/param.h>
 #include <sys/types.h>				/* concession to AIX */
 #include <sys/socket.h>
-#include <sys/time.h>
 #include <sys/wait.h>
 
 #if __STDC__
@@ -59,9 +58,18 @@ struct rtentry;
 #include <stdlib.h>
 #include <string.h>
 #include <syslog.h>
-#ifdef TIME_WITH_SYS_TIME
-#include <time.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
 #endif
+
 #include <unistd.h>
 
 #include "gnuc.h"
