From c53dc961196b0568b5af0736d52d854daf27335d Mon Sep 17 00:00:00 2001
From: Ismael Luceno <ismael@iodev.co.uk>
Date: Wed, 3 Mar 2021 20:01:33 +0100
Subject: [PATCH] Fix missing include in externs.h

The time.h header file is required to make the timespec struct available
for the prototypes.

Also remove the duplication in files including the system.h header file.

Upstream-Status: Accepted
Fixes: https://github.com/cisco/ChezScheme/issues/281
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
 c/expeditor.c | 1 -
 c/externs.h   | 1 +
 c/prim5.c     | 1 -
 c/scheme.c    | 1 -
 c/stats.c     | 2 --
 5 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/c/expeditor.c b/c/expeditor.c
index dfd0b81df23d..c148e96bf62d 100644
--- a/c/expeditor.c
+++ b/c/expeditor.c
@@ -547,7 +547,6 @@ static void s_ee_write_char(wchar_t c) {
 #endif /* SOLARIS */
 #include <termios.h>
 #include <signal.h>
-#include <time.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <wchar.h>
diff --git a/c/externs.h b/c/externs.h
index c660f5306207..cab30fe00828 100644
--- a/c/externs.h
+++ b/c/externs.h
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <time.h>
 
 #ifndef WIN32
 #include <unistd.h>
diff --git a/c/prim5.c b/c/prim5.c
index 3abde4638b0d..fd4a63bee202 100644
--- a/c/prim5.c
+++ b/c/prim5.c
@@ -21,7 +21,6 @@
 #include <sys/stat.h>
 #include <limits.h>
 #include <ctype.h>
-#include <time.h>
 
 /* locally defined functions */
 static INT s_errno PROTO((void));
diff --git a/c/scheme.c b/c/scheme.c
index d6a5afba890d..2f56352d9bfa 100644
--- a/c/scheme.c
+++ b/c/scheme.c
@@ -20,7 +20,6 @@
 #include <limits.h>
 #ifdef WIN32
 #include <io.h>
-#include <time.h>
 #else
 #include <sys/time.h>
 #endif
diff --git a/c/stats.c b/c/stats.c
index e254546e73b1..7157974f3838 100644
--- a/c/stats.c
+++ b/c/stats.c
@@ -34,8 +34,6 @@
 #include <sys/resource.h>
 #endif
 
-#include <time.h>
-
 static struct timespec starting_mono_tp;
 
 static long adjust_time_zone(ptr dtvec, struct tm *tmxp, ptr given_tzoff);
-- 
2.30.1

