aboutsummaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
Diffstat (limited to 'time')
-rw-r--r--time/mktime.c8
-rw-r--r--time/strftime.c6
2 files changed, 13 insertions, 1 deletions
diff --git a/time/mktime.c b/time/mktime.c
index fda08a25fb..0fa92e0e65 100644
--- a/time/mktime.c
+++ b/time/mktime.c
@@ -47,6 +47,12 @@
# define LEAP_SECONDS_POSSIBLE 1
#endif
+/* Some systems require <unistd.h> to be included before <time.h>
+ for localtime_r to be declared properly. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
@@ -64,7 +70,7 @@
#endif /* DEBUG */
#ifndef __P
-# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+# if defined __GNUC__ || (defined __STDC__ && __STDC__)
# define __P(args) args
# else
# define __P(args) ()
diff --git a/time/strftime.c b/time/strftime.c
index 438384caf3..69babade36 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -46,6 +46,12 @@
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
+/* Some systems require <unistd.h> to be included before <time.h>
+ for localtime_r to be declared properly. */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>