about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog42
-rw-r--r--bits/resource.h3
-rw-r--r--bits/time.h54
-rw-r--r--include/bits/types/clock_t.h1
-rw-r--r--include/bits/types/clockid_t.h1
-rw-r--r--include/bits/types/struct_itimerspec.h1
-rw-r--r--include/bits/types/struct_timespec.h1
-rw-r--r--include/bits/types/struct_timeval.h1
-rw-r--r--include/bits/types/struct_tm.h1
-rw-r--r--include/bits/types/time_t.h1
-rw-r--r--include/bits/types/timer_t.h1
-rw-r--r--include/time.h7
-rw-r--r--io/fcntl.h3
-rw-r--r--io/sys/poll.h3
-rw-r--r--io/sys/stat.h13
-rw-r--r--io/utime.h3
-rw-r--r--misc/sys/select.h8
-rw-r--r--posix/sched.h9
-rw-r--r--posix/sys/times.h4
-rw-r--r--posix/sys/types.h9
-rw-r--r--resolv/netdb.h3
-rw-r--r--rt/aio.h3
-rw-r--r--rt/mqueue.h3
-rw-r--r--signal/signal.h3
-rw-r--r--sysdeps/nptl/pthread.h1
-rw-r--r--sysdeps/pthread/semaphore.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/bits/resource.h3
-rw-r--r--sysdeps/unix/sysv/linux/alpha/sys/acct.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/resource.h3
-rw-r--r--sysdeps/unix/sysv/linux/bits/time.h68
-rw-r--r--sysdeps/unix/sysv/linux/bits/timex.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/resource.h3
-rw-r--r--sysdeps/unix/sysv/linux/net/ppp_defs.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/resource.h3
-rw-r--r--sysdeps/unix/sysv/linux/sys/acct.h3
-rw-r--r--sysdeps/unix/sysv/linux/sys/timerfd.h1
-rw-r--r--sysvipc/sys/msg.h3
-rw-r--r--sysvipc/sys/sem.h3
-rw-r--r--sysvipc/sys/shm.h3
-rw-r--r--time/Makefile7
-rw-r--r--time/bits/types/clock_t.h15
-rw-r--r--time/bits/types/clockid_t.h9
-rw-r--r--time/bits/types/struct_itimerspec.h14
-rw-r--r--time/bits/types/struct_timespec.h14
-rw-r--r--time/bits/types/struct_timeval.h13
-rw-r--r--time/bits/types/struct_tm.h33
-rw-r--r--time/bits/types/time_t.h14
-rw-r--r--time/bits/types/timer_t.h9
-rw-r--r--time/sys/time.h9
-rw-r--r--time/sys/timeb.h4
-rw-r--r--time/time.h237
51 files changed, 327 insertions, 335 deletions
diff --git a/ChangeLog b/ChangeLog
index 60500b47c8..b428ba42ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,47 @@
 2016-09-23  Zack Weinberg  <zackw@panix.com>
 
+	* time/time.h, bits/time.h, sysdeps/unix/sysv/linux/bits/time.h:
+	Remove all logic conditional on __need macros.	Move all the
+	conditionally defined types to their own headers...
+	* time/bits/types/clock_t.h: Define clock_t here.
+	* time/bits/types/clockid_t.h: Define clockid_t here.
+	* time/bits/types/struct_itimerspec.h: Define struct itimerspec here.
+	* time/bits/types/struct_timespec.h: Define struct timespec here.
+	* time/bits/types/struct_timeval.h: Define struct timeval here.
+	* time/bits/types/struct_tm.h: Define struct tm here.
+	* time/bits/types/time_t.h: Define time_t here.
+	* time/bits/types/timer_t.h: Define timer_t here.
+	* time/Makefile: Install the new headers.
+
+	* bits/resource.h, io/fcntl.h, io/sys/poll.h, io/sys/stat.h
+	* io/utime.h, misc/sys/select.h, posix/sched.h, posix/sys/times.h
+	* posix/sys/types.h, resolv/netdb.h, rt/aio.h, rt/mqueue.h
+	* signal/signal.h, pthread/semaphore.h, sysdeps/nptl/pthread.h
+	* sysdeps/unix/sysv/linux/alpha/bits/resource.h
+	* sysdeps/unix/sysv/linux/alpha/sys/acct.h
+	* sysdeps/unix/sysv/linux/bits/resource.h
+	* sysdeps/unix/sysv/linux/bits/timex.h
+	* sysdeps/unix/sysv/linux/mips/bits/resource.h
+	* sysdeps/unix/sysv/linux/net/ppp_defs.h
+	* sysdeps/unix/sysv/linux/sparc/bits/resource.h
+	* sysdeps/unix/sysv/linux/sys/acct.h
+	* sysdeps/unix/sysv/linux/sys/timerfd.h
+	* sysvipc/sys/msg.h, sysvipc/sys/sem.h, sysvipc/sys/shm.h
+	* time/sys/time.h, time/sys/timeb.h
+	Use the new bits/types headers.
+
+	* include/time.h: Remove __need logic.
+	* include/bits/time.h
+	* include/bits/types/clock_t.h, include/bits/types/clockid_t.h
+	* include/bits/types/time_t.h, include/bits/types/timer_t.h
+	* include/bits/types/struct_itimerspec.h
+	* include/bits/types/struct_timespec.h
+	* include/bits/types/struct_timeval.h
+	* include/bits/types/struct_tm.h:
+	New wrapper headers.
+
+2016-09-23  Zack Weinberg  <zackw@panix.com>
+
 	* sysdeps/mach/hurd/net/if_ppp.h
 	* sysdeps/unix/sysv/linux/net/if_ppp.h:
 	Only define struct ifpppstatsreq and struct ifpppcstatsreq
diff --git a/bits/resource.h b/bits/resource.h
index 7d2d66c7c9..5cd2fe56a2 100644
--- a/bits/resource.h
+++ b/bits/resource.h
@@ -129,8 +129,7 @@ enum __rusage_who
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
   };
 
-#define __need_timeval
-#include <bits/time.h>           /* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/bits/time.h b/bits/time.h
index 19c7ab0997..84e0e94a17 100644
--- a/bits/time.h
+++ b/bits/time.h
@@ -20,9 +20,10 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#ifndef __need_timeval
-# ifndef _BITS_TIME_H
-#  define _BITS_TIME_H	1
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
+
+#include <bits/types.h>
 
 /* ISO/IEC 9899:1999 7.23.1: Components of time
    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
@@ -30,51 +31,34 @@
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  ((clock_t) 1000000)
+#define CLOCKS_PER_SEC  ((__clock_t) 1000000)
 
-#  if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
+#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
+   && !defined __USE_XOPEN2K
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#   include <bits/types.h>
 extern long int __sysconf (int);
-#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
-#  endif
+# define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#endif
 
-#  ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Identifier for system-wide realtime clock.  */
-#   define CLOCK_REALTIME		0
+# define CLOCK_REALTIME			0
 /* Monotonic system-wide clock.  */
-#   define CLOCK_MONOTONIC		1
+# define CLOCK_MONOTONIC		1
 /* High-resolution timer from the CPU.  */
-#   define CLOCK_PROCESS_CPUTIME_ID	2
+# define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
-#   define CLOCK_THREAD_CPUTIME_ID	3
+# define CLOCK_THREAD_CPUTIME_ID	3
 /* Monotonic system-wide clock, not adjusted for frequency scaling.  */
-#   define CLOCK_MONOTONIC_RAW		4
+# define CLOCK_MONOTONIC_RAW		4
 /* Identifier for system-wide realtime clock, updated only on ticks.  */
-#   define CLOCK_REALTIME_COARSE	5
+# define CLOCK_REALTIME_COARSE		5
 /* Monotonic system-wide clock, updated only on ticks.  */
-#   define CLOCK_MONOTONIC_COARSE	6
+# define CLOCK_MONOTONIC_COARSE		6
 
 /* Flag to indicate time is absolute.  */
-#   define TIMER_ABSTIME		1
-#  endif
-
-# endif	/* bits/time.h */
+# define TIMER_ABSTIME			1
 #endif
 
-#ifdef __need_timeval
-# undef __need_timeval
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-#  include <bits/types.h>
-
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __suseconds_t tv_usec;	/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif	/* need timeval */
+#endif	/* bits/time.h */
diff --git a/include/bits/types/clock_t.h b/include/bits/types/clock_t.h
new file mode 100644
index 0000000000..a08940dbef
--- /dev/null
+++ b/include/bits/types/clock_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/clock_t.h"
diff --git a/include/bits/types/clockid_t.h b/include/bits/types/clockid_t.h
new file mode 100644
index 0000000000..fb0a514446
--- /dev/null
+++ b/include/bits/types/clockid_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/clockid_t.h"
diff --git a/include/bits/types/struct_itimerspec.h b/include/bits/types/struct_itimerspec.h
new file mode 100644
index 0000000000..7d325d6f3c
--- /dev/null
+++ b/include/bits/types/struct_itimerspec.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_itimerspec.h"
diff --git a/include/bits/types/struct_timespec.h b/include/bits/types/struct_timespec.h
new file mode 100644
index 0000000000..b8ec6a3862
--- /dev/null
+++ b/include/bits/types/struct_timespec.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_timespec.h"
diff --git a/include/bits/types/struct_timeval.h b/include/bits/types/struct_timeval.h
new file mode 100644
index 0000000000..5d2cb78259
--- /dev/null
+++ b/include/bits/types/struct_timeval.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_timeval.h"
diff --git a/include/bits/types/struct_tm.h b/include/bits/types/struct_tm.h
new file mode 100644
index 0000000000..b70ac52f68
--- /dev/null
+++ b/include/bits/types/struct_tm.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/struct_tm.h"
diff --git a/include/bits/types/time_t.h b/include/bits/types/time_t.h
new file mode 100644
index 0000000000..16e75e19be
--- /dev/null
+++ b/include/bits/types/time_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/time_t.h"
diff --git a/include/bits/types/timer_t.h b/include/bits/types/timer_t.h
new file mode 100644
index 0000000000..e6b279bfcc
--- /dev/null
+++ b/include/bits/types/timer_t.h
@@ -0,0 +1 @@
+#include "../../time/bits/types/timer_t.h"
diff --git a/include/time.h b/include/time.h
index 8dd10dcdd8..684ceb812f 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,8 +1,7 @@
 #ifndef _TIME_H
-#if defined __need_time_t  || defined __need_clock_t || defined __need_timespec || defined _ISOMAC
-# include <time/time.h>
-#else
-# include <time/time.h>
+#include <time/time.h>
+
+#ifndef _ISOMAC
 # include <xlocale.h>
 
 __BEGIN_DECLS
diff --git a/io/fcntl.h b/io/fcntl.h
index cb706b4f0f..12099a2181 100644
--- a/io/fcntl.h
+++ b/io/fcntl.h
@@ -72,8 +72,7 @@ typedef __pid_t pid_t;
 
 /* For XPG all symbols from <sys/stat.h> should also be available.  */
 #ifdef __USE_XOPEN2K8
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
 # include <bits/stat.h>
diff --git a/io/sys/poll.h b/io/sys/poll.h
index e751860acd..58498b0187 100644
--- a/io/sys/poll.h
+++ b/io/sys/poll.h
@@ -27,8 +27,7 @@
 /* Get the __sigset_t definition.  */
 # include <bits/sigset.h>
 /* Get the timespec definition.  */
-# define __need_timespec
-# include <time.h>
+#include <bits/types/struct_timespec.h>
 #endif
 
 
diff --git a/io/sys/stat.h b/io/sys/stat.h
index 6925f61ae5..71462a7f62 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -26,19 +26,16 @@
 
 #include <bits/types.h>		/* For __mode_t and __dev_t.  */
 
-#if defined __USE_XOPEN || defined __USE_XOPEN2K || defined __USE_ATFILE
-# if defined __USE_XOPEN || defined __USE_XOPEN2K
-#  define __need_time_t
-# endif
-# ifdef __USE_ATFILE
-#  define __need_timespec
-# endif
-# include <time.h>		/* For time_t resp. timespec.  */
+#ifdef __USE_ATFILE
+# include <bits/types/struct_timespec.h>
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
 /* The Single Unix specification says that some more types are
    available here.  */
+
+# include <bits/types/time_t.h>
+
 # ifndef __dev_t_defined
 typedef __dev_t dev_t;
 #  define __dev_t_defined
diff --git a/io/utime.h b/io/utime.h
index 3cc0d5e99d..b30e1cc022 100644
--- a/io/utime.h
+++ b/io/utime.h
@@ -29,8 +29,7 @@ __BEGIN_DECLS
 #include <bits/types.h>
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K
-# define __need_time_t
-# include <time.h>
+# include <bits/types/time_t.h>
 #endif
 
 /* Structure describing file times.  */
diff --git a/misc/sys/select.h b/misc/sys/select.h
index 52dd94fe01..2e4de407d7 100644
--- a/misc/sys/select.h
+++ b/misc/sys/select.h
@@ -38,13 +38,11 @@ typedef __sigset_t sigset_t;
 #endif
 
 /* Get definition of timer specification structures.  */
-#define __need_time_t
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timeval.h>
 #ifdef __USE_XOPEN2K
-# define __need_timespec
+# include <bits/types/struct_timespec.h>
 #endif
-#include <time.h>
-#define __need_timeval
-#include <bits/time.h>
 
 #ifndef __suseconds_t_defined
 typedef __suseconds_t suseconds_t;
diff --git a/posix/sched.h b/posix/sched.h
index 253c963053..5b431c64bf 100644
--- a/posix/sched.h
+++ b/posix/sched.h
@@ -25,13 +25,14 @@
 #include <bits/types.h>
 
 #define __need_size_t
+#define __need_NULL
 #include <stddef.h>
 
-#ifdef __USE_XOPEN2K
-# define __need_time_t
-# define __need_timespec
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timespec.h>
+#ifndef __USE_XOPEN2K
+# include <time.h>
 #endif
-#include <time.h>
 
 #ifndef __pid_t_defined
 typedef __pid_t pid_t;
diff --git a/posix/sys/times.h b/posix/sys/times.h
index a877d1490d..c7308d2617 100644
--- a/posix/sys/times.h
+++ b/posix/sys/times.h
@@ -24,9 +24,7 @@
 
 #include <features.h>
 
-#define	__need_clock_t
-#include <time.h>
-
+#include <bits/types/clock_t.h>
 
 __BEGIN_DECLS
 
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 83dadcdd05..386f3e5703 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -124,12 +124,11 @@ typedef __key_t key_t;
 #endif
 
 #if defined __USE_XOPEN || defined __USE_XOPEN2K8
-# define __need_clock_t
+# include <bits/types/clock_t.h>
 #endif
-#define	__need_time_t
-#define __need_timer_t
-#define __need_clockid_t
-#include <time.h>
+#include <bits/types/clockid_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/timer_t.h>
 
 #ifdef __USE_XOPEN
 # ifndef __useconds_t_defined
diff --git a/resolv/netdb.h b/resolv/netdb.h
index 3aba530932..9a409c0445 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -35,8 +35,7 @@
 #ifdef __USE_GNU
 # define __need_sigevent_t
 # include <bits/siginfo.h>
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 #include <bits/netdb.h>
diff --git a/rt/aio.h b/rt/aio.h
index 8cb6a5ea85..bc70082df5 100644
--- a/rt/aio.h
+++ b/rt/aio.h
@@ -26,8 +26,7 @@
 #include <sys/types.h>
 #define __need_sigevent_t
 #include <bits/siginfo.h>
-#define __need_timespec
-#include <time.h>
+#include <bits/types/struct_timespec.h>
 
 __BEGIN_DECLS
 
diff --git a/rt/mqueue.h b/rt/mqueue.h
index 9700cdc93f..db6022f0f1 100644
--- a/rt/mqueue.h
+++ b/rt/mqueue.h
@@ -23,8 +23,7 @@
 #include <fcntl.h>
 #define __need_sigevent_t
 #include <bits/siginfo.h>
-#define __need_timespec
-#include <time.h>
+#include <bits/types/struct_timespec.h>
 /* Get the definition of mqd_t and struct mq_attr.  */
 #include <bits/mqueue.h>
 
diff --git a/signal/signal.h b/signal/signal.h
index 47e995a51c..2825386b97 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -71,8 +71,7 @@ typedef __uid_t uid_t;
 
 #ifdef __USE_POSIX199309
 /* We need `struct timespec' later on.  */
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 #if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
index fd0894efd2..cc6517bca1 100644
--- a/sysdeps/nptl/pthread.h
+++ b/sysdeps/nptl/pthread.h
@@ -26,6 +26,7 @@
 #include <bits/pthreadtypes.h>
 #include <bits/setjmp.h>
 #include <bits/wordsize.h>
+#include <bits/types/struct_timespec.h>
 
 
 /* Detach state.  */
diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h
index 9927db7667..5508267c0c 100644
--- a/sysdeps/pthread/semaphore.h
+++ b/sysdeps/pthread/semaphore.h
@@ -21,8 +21,7 @@
 #include <features.h>
 #include <sys/types.h>
 #ifdef __USE_XOPEN2K
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 /* Get the definition for sem_t.  */
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index fbc8f5a026..1c17605bd5 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -175,8 +175,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/alpha/sys/acct.h b/sysdeps/unix/sysv/linux/alpha/sys/acct.h
index 01da7bf035..9fb9bdc35a 100644
--- a/sysdeps/unix/sysv/linux/alpha/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/alpha/sys/acct.h
@@ -20,9 +20,7 @@
 #define _SYS_ACCT_H	1
 #include <features.h>
 
-#define	__need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/bits/resource.h b/sysdeps/unix/sysv/linux/bits/resource.h
index 8af0e0e95e..e2a62bc6e5 100644
--- a/sysdeps/unix/sysv/linux/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/bits/resource.h
@@ -175,8 +175,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 
diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h
index 87eb51f2ed..1fade54b62 100644
--- a/sysdeps/unix/sysv/linux/bits/time.h
+++ b/sysdeps/unix/sysv/linux/bits/time.h
@@ -20,24 +20,10 @@
  * Never include this file directly; use <time.h> instead.
  */
 
-#if defined __need_timeval || defined __USE_GNU
-# ifndef _STRUCT_TIMEVAL
-#  define _STRUCT_TIMEVAL	1
-#  include <bits/types.h>
+#ifndef _BITS_TIME_H
+#define _BITS_TIME_H	1
 
-/* A time value that is accurate to the nearest
-   microsecond but also has a range of years.  */
-struct timeval
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __suseconds_t tv_usec;	/* Microseconds.  */
-  };
-# endif	/* struct timeval */
-#endif
-
-#ifndef __need_timeval
-# ifndef _BITS_TIME_H
-#  define _BITS_TIME_H	1
+#include <bits/types.h>
 
 /* ISO/IEC 9899:1999 7.23.1: Components of time
    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
@@ -45,47 +31,46 @@ struct timeval
 /* CAE XSH, Issue 4, Version 2: <time.h>
    The value of CLOCKS_PER_SEC is required to be 1 million on all
    XSI-conformant systems. */
-#  define CLOCKS_PER_SEC  ((clock_t) 1000000)
+#define CLOCKS_PER_SEC  ((__clock_t) 1000000)
 
-#  if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
+#if (!defined __STRICT_ANSI__ || defined __USE_POSIX) \
    && !defined __USE_XOPEN2K
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-#   include <bits/types.h>
 extern long int __sysconf (int);
-#   define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
-#  endif
+# define CLK_TCK ((__clock_t) __sysconf (2))	/* 2 is _SC_CLK_TCK */
+#endif
 
-#  ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Identifier for system-wide realtime clock.  */
-#   define CLOCK_REALTIME		0
+# define CLOCK_REALTIME			0
 /* Monotonic system-wide clock.  */
-#   define CLOCK_MONOTONIC		1
+# define CLOCK_MONOTONIC		1
 /* High-resolution timer from the CPU.  */
-#   define CLOCK_PROCESS_CPUTIME_ID	2
+# define CLOCK_PROCESS_CPUTIME_ID	2
 /* Thread-specific CPU-time clock.  */
-#   define CLOCK_THREAD_CPUTIME_ID	3
+# define CLOCK_THREAD_CPUTIME_ID	3
 /* Monotonic system-wide clock, not adjusted for frequency scaling.  */
-#   define CLOCK_MONOTONIC_RAW		4
+# define CLOCK_MONOTONIC_RAW		4
 /* Identifier for system-wide realtime clock, updated only on ticks.  */
-#   define CLOCK_REALTIME_COARSE	5
+# define CLOCK_REALTIME_COARSE		5
 /* Monotonic system-wide clock, updated only on ticks.  */
-#   define CLOCK_MONOTONIC_COARSE	6
+# define CLOCK_MONOTONIC_COARSE		6
 /* Monotonic system-wide clock that includes time spent in suspension.  */
-#   define CLOCK_BOOTTIME		7
+# define CLOCK_BOOTTIME			7
 /* Like CLOCK_REALTIME but also wakes suspended system.  */
-#   define CLOCK_REALTIME_ALARM		8
+# define CLOCK_REALTIME_ALARM		8
 /* Like CLOCK_BOOTTIME but also wakes suspended system.  */
-#   define CLOCK_BOOTTIME_ALARM		9
+# define CLOCK_BOOTTIME_ALARM		9
 /* Like CLOCK_REALTIME but in International Atomic Time.  */
-#   define CLOCK_TAI			11
+# define CLOCK_TAI			11
 
 /* Flag to indicate time is absolute.  */
-#   define TIMER_ABSTIME		1
-#  endif
+# define TIMER_ABSTIME			1
+#endif
 
-#  ifdef __USE_GNU
-#   include <bits/timex.h>
+#ifdef __USE_GNU
+# include <bits/timex.h>
 
 __BEGIN_DECLS
 
@@ -93,9 +78,6 @@ __BEGIN_DECLS
 extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW;
 
 __END_DECLS
-#  endif /* use GNU */
-
-# endif	/* bits/time.h */
-#endif
+#endif /* use GNU */
 
-#undef __need_timeval
+#endif	/* bits/time.h */
diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h
index 5eb7ccbd2e..1bf6121d88 100644
--- a/sysdeps/unix/sysv/linux/bits/timex.h
+++ b/sysdeps/unix/sysv/linux/bits/timex.h
@@ -19,6 +19,7 @@
 #define	_BITS_TIMEX_H	1
 
 #include <bits/types.h>
+#include <bits/types/struct_timeval.h>
 
 /* These definitions from linux/timex.h as of 3.18.  */
 
diff --git a/sysdeps/unix/sysv/linux/mips/bits/resource.h b/sysdeps/unix/sysv/linux/mips/bits/resource.h
index 4ce5ff6dd0..e3bcccfea8 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/resource.h
@@ -183,8 +183,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/net/ppp_defs.h b/sysdeps/unix/sysv/linux/net/ppp_defs.h
index f8924c4f27..5e492e9dbf 100644
--- a/sysdeps/unix/sysv/linux/net/ppp_defs.h
+++ b/sysdeps/unix/sysv/linux/net/ppp_defs.h
@@ -1,9 +1,7 @@
 #ifndef _NET_PPP_DEFS_H
 #define _NET_PPP_DEFS_H 1
 
-#define __need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 #include <asm/types.h>
 #include <linux/ppp_defs.h>
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/resource.h b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
index 305ca5ef93..c5eac6fe0e 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/resource.h
@@ -191,8 +191,7 @@ enum __rusage_who
 #endif
 };
 
-#define __need_timeval
-#include <bits/time.h>		/* For `struct timeval'.  */
+#include <bits/types/struct_timeval.h>
 
 /* Structure which says how much of each resource has been used.  */
 struct rusage
diff --git a/sysdeps/unix/sysv/linux/sys/acct.h b/sysdeps/unix/sysv/linux/sys/acct.h
index d24c2a7267..bc8a08e96b 100644
--- a/sysdeps/unix/sysv/linux/sys/acct.h
+++ b/sysdeps/unix/sysv/linux/sys/acct.h
@@ -21,8 +21,7 @@
 #include <sys/types.h>
 #include <stdint.h>
 #include <endian.h>
-#define	__need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index d037213049..492c488c5d 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -19,6 +19,7 @@
 #define	_SYS_TIMERFD_H	1
 
 #include <time.h>
+#include <bits/types/struct_itimerspec.h>
 
 /* Get the platform-dependent flags.  */
 #include <bits/timerfd.h>
diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h
index 4dc559f49a..4499dc5e91 100644
--- a/sysvipc/sys/msg.h
+++ b/sysvipc/sys/msg.h
@@ -30,8 +30,7 @@
 #include <bits/msq.h>
 
 /* Define types required by the standard.  */
-#define	__need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 #ifndef __pid_t_defined
 typedef __pid_t pid_t;
diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h
index 1b32092922..3a79f9d27a 100644
--- a/sysvipc/sys/sem.h
+++ b/sysvipc/sys/sem.h
@@ -30,8 +30,7 @@
 #include <bits/sem.h>
 
 #ifdef __USE_GNU
-# define __need_timespec
-# include <time.h>
+# include <bits/types/struct_timespec.h>
 #endif
 
 /* The following System V style IPC functions implement a semaphore
diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h
index df263dcba6..41dc6c63f7 100644
--- a/sysvipc/sys/shm.h
+++ b/sysvipc/sys/shm.h
@@ -30,8 +30,7 @@
 #include <bits/shm.h>
 
 /* Define types required by the standard.  */
-#define __need_time_t
-#include <time.h>
+#include <bits/types/time_t.h>
 
 #ifdef __USE_XOPEN
 # ifndef __pid_t_defined
diff --git a/time/Makefile b/time/Makefile
index e052c0765d..326a81bcae 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -22,7 +22,12 @@ subdir	:= time
 
 include ../Makeconfig
 
-headers	:= time.h sys/time.h sys/timeb.h bits/time.h
+headers := time.h sys/time.h sys/timeb.h bits/time.h			\
+	   bits/types/clockid_t.h bits/types/clock_t.h			\
+	   bits/types/struct_itimerspec.h				\
+	   bits/types/struct_timespec.h bits/types/struct_timeval.h	\
+	   bits/types/struct_tm.h bits/types/timer_t.h			\
+	   bits/types/time_t.h
 
 routines := offtime asctime clock ctime ctime_r difftime \
 	    gmtime localtime mktime time		 \
diff --git a/time/bits/types/clock_t.h b/time/bits/types/clock_t.h
new file mode 100644
index 0000000000..b8cbaf2cb6
--- /dev/null
+++ b/time/bits/types/clock_t.h
@@ -0,0 +1,15 @@
+#ifndef __clock_t_defined
+#define __clock_t_defined 1
+
+#include <bits/types.h>
+
+__BEGIN_NAMESPACE_STD
+/* Returned by `clock'.  */
+typedef __clock_t clock_t;
+__END_NAMESPACE_STD
+
+#if defined __USE_XOPEN || defined __USE_POSIX
+__USING_NAMESPACE_STD(clock_t)
+#endif
+
+#endif
diff --git a/time/bits/types/clockid_t.h b/time/bits/types/clockid_t.h
new file mode 100644
index 0000000000..b17c7da853
--- /dev/null
+++ b/time/bits/types/clockid_t.h
@@ -0,0 +1,9 @@
+#ifndef __clockid_t_defined
+#define __clockid_t_defined 1
+
+#include <bits/types.h>
+
+/* Clock ID used in clock and timer functions.  */
+typedef __clockid_t clockid_t;
+
+#endif
diff --git a/time/bits/types/struct_itimerspec.h b/time/bits/types/struct_itimerspec.h
new file mode 100644
index 0000000000..17cc1ac86d
--- /dev/null
+++ b/time/bits/types/struct_itimerspec.h
@@ -0,0 +1,14 @@
+#ifndef __itimerspec_defined
+#define __itimerspec_defined 1
+
+#include <bits/types.h>
+#include <bits/types/struct_timespec.h>
+
+/* POSIX.1b structure for timer start values and intervals.  */
+struct itimerspec
+  {
+    struct timespec it_interval;
+    struct timespec it_value;
+  };
+
+#endif
diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h
new file mode 100644
index 0000000000..644db9fdb6
--- /dev/null
+++ b/time/bits/types/struct_timespec.h
@@ -0,0 +1,14 @@
+#ifndef __timespec_defined
+#define __timespec_defined 1
+
+#include <bits/types.h>
+
+/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
+   has nanoseconds instead of microseconds.  */
+struct timespec
+{
+  __time_t tv_sec;		/* Seconds.  */
+  __syscall_slong_t tv_nsec;	/* Nanoseconds.  */
+};
+
+#endif
diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h
new file mode 100644
index 0000000000..70394ce886
--- /dev/null
+++ b/time/bits/types/struct_timeval.h
@@ -0,0 +1,13 @@
+#ifndef __timeval_defined
+#define __timeval_defined 1
+
+#include <bits/types.h>
+
+/* A time value that is accurate to the nearest
+   microsecond but also has a range of years.  */
+struct timeval
+{
+  __time_t tv_sec;		/* Seconds.  */
+  __suseconds_t tv_usec;	/* Microseconds.  */
+};
+#endif
diff --git a/time/bits/types/struct_tm.h b/time/bits/types/struct_tm.h
new file mode 100644
index 0000000000..8f5af16715
--- /dev/null
+++ b/time/bits/types/struct_tm.h
@@ -0,0 +1,33 @@
+#ifndef __struct_tm_defined
+#define __struct_tm_defined 1
+
+#include <bits/types.h>
+
+/* ISO C `broken-down time' structure.  */
+__BEGIN_NAMESPACE_STD
+struct tm
+{
+  int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
+  int tm_min;			/* Minutes.	[0-59] */
+  int tm_hour;			/* Hours.	[0-23] */
+  int tm_mday;			/* Day.		[1-31] */
+  int tm_mon;			/* Month.	[0-11] */
+  int tm_year;			/* Year	- 1900.  */
+  int tm_wday;			/* Day of week.	[0-6] */
+  int tm_yday;			/* Days in year.[0-365]	*/
+  int tm_isdst;			/* DST.		[-1/0/1]*/
+
+# ifdef	__USE_MISC
+  long int tm_gmtoff;		/* Seconds east of UTC.  */
+  const char *tm_zone;		/* Timezone abbreviation.  */
+# else
+  long int __tm_gmtoff;		/* Seconds east of UTC.  */
+  const char *__tm_zone;	/* Timezone abbreviation.  */
+# endif
+};
+__END_NAMESPACE_STD
+#if defined __USE_XOPEN || defined __USE_POSIX
+__USING_NAMESPACE_STD(tm)
+#endif
+
+#endif
diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h
new file mode 100644
index 0000000000..16e5269184
--- /dev/null
+++ b/time/bits/types/time_t.h
@@ -0,0 +1,14 @@
+#ifndef __time_t_defined
+#define __time_t_defined 1
+
+#include <bits/types.h>
+
+__BEGIN_NAMESPACE_STD
+/* Returned by `time'.  */
+typedef __time_t time_t;
+__END_NAMESPACE_STD
+#ifdef __USE_POSIX
+__USING_NAMESPACE_STD(time_t)
+#endif
+
+#endif
diff --git a/time/bits/types/timer_t.h b/time/bits/types/timer_t.h
new file mode 100644
index 0000000000..d71a4130e2
--- /dev/null
+++ b/time/bits/types/timer_t.h
@@ -0,0 +1,9 @@
+#ifndef __timer_t_defined
+#define __timer_t_defined 1
+
+#include <bits/types.h>
+
+/* Timer ID returned by `timer_create'.  */
+typedef __timer_t timer_t;
+
+#endif
diff --git a/time/sys/time.h b/time/sys/time.h
index 545de6f3d8..89d574f54d 100644
--- a/time/sys/time.h
+++ b/time/sys/time.h
@@ -21,18 +21,15 @@
 #include <features.h>
 
 #include <bits/types.h>
-#define __need_time_t
-#include <time.h>
-#define __need_timeval
-#include <bits/time.h>
-
-#include <sys/select.h>
+#include <bits/types/time_t.h>
+#include <bits/types/struct_timeval.h>
 
 #ifndef __suseconds_t_defined
 typedef __suseconds_t suseconds_t;
 # define __suseconds_t_defined
 #endif
 
+#include <sys/select.h>
 
 __BEGIN_DECLS
 
diff --git a/time/sys/timeb.h b/time/sys/timeb.h
index 41d71bf9e9..1e7d0a943b 100644
--- a/time/sys/timeb.h
+++ b/time/sys/timeb.h
@@ -20,9 +20,7 @@
 
 #include <features.h>
 
-#define __need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
diff --git a/time/time.h b/time/time.h
index cc93917b82..c38fac7ff8 100644
--- a/time/time.h
+++ b/time/time.h
@@ -20,168 +20,52 @@
  */
 
 #ifndef	_TIME_H
+#define _TIME_H	1
 
-#if (! defined __need_time_t && !defined __need_clock_t && \
-     ! defined __need_timespec)
-# define _TIME_H	1
-# include <features.h>
+#include <features.h>
 
-__BEGIN_DECLS
-
-#endif
-
-#ifdef	_TIME_H
-/* Get size_t and NULL from <stddef.h>.  */
-# define __need_size_t
-# define __need_NULL
-# include <stddef.h>
+#define __need_size_t
+#define __need_NULL
+#include <stddef.h>
 
 /* This defines CLOCKS_PER_SEC, which is the number of processor clock
-   ticks per second.  */
-# include <bits/time.h>
-
-/* This is the obsolete POSIX.1-1988 name for the same constant.  */
-# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
-#  ifndef CLK_TCK
-#   define CLK_TCK	CLOCKS_PER_SEC
-#  endif
-# endif
-
-#endif /* <time.h> included.  */
-
-#if !defined __clock_t_defined && (defined _TIME_H || defined __need_clock_t)
-# define __clock_t_defined	1
-
-# include <bits/types.h>
-
-__BEGIN_NAMESPACE_STD
-/* Returned by `clock'.  */
-typedef __clock_t clock_t;
-__END_NAMESPACE_STD
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(clock_t)
-#endif
-
-#endif /* clock_t not defined and <time.h> or need clock_t.  */
-#undef	__need_clock_t
-
-#if !defined __time_t_defined && (defined _TIME_H || defined __need_time_t)
-# define __time_t_defined	1
-
-# include <bits/types.h>
-
-__BEGIN_NAMESPACE_STD
-/* Returned by `time'.  */
-typedef __time_t time_t;
-__END_NAMESPACE_STD
-#ifdef __USE_POSIX
-__USING_NAMESPACE_STD(time_t)
-#endif
-
-#endif /* time_t not defined and <time.h> or need time_t.  */
-#undef	__need_time_t
-
-#if !defined __clockid_t_defined && \
-   ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_clockid_t)
-# define __clockid_t_defined	1
-
-# include <bits/types.h>
-
-/* Clock ID used in clock and timer functions.  */
-typedef __clockid_t clockid_t;
-
-#endif /* clockid_t not defined and <time.h> or need clockid_t.  */
-#undef	__clockid_time_t
-
-#if !defined __timer_t_defined && \
-    ((defined _TIME_H && defined __USE_POSIX199309) || defined __need_timer_t)
-# define __timer_t_defined	1
-
-# include <bits/types.h>
-
-/* Timer ID returned by `timer_create'.  */
-typedef __timer_t timer_t;
-
-#endif /* timer_t not defined and <time.h> or need timer_t.  */
-#undef	__need_timer_t
+   ticks per second, and possibly a number of other constants.   */
+#include <bits/time.h>
 
+/* Many of the typedefs and structs whose official home is this header
+   may also need to be defined by other headers.  */
+#include <bits/types/clock_t.h>
+#include <bits/types/time_t.h>
+#include <bits/types/struct_tm.h>
 
-#if (!defined __timespec_defined					\
-     && ((defined _TIME_H						\
-	  && (defined __USE_POSIX199309					\
-	      || defined __USE_ISOC11))					\
-	 || defined __need_timespec))
-# define __timespec_defined	1
-
-# include <bits/types.h>	/* This defines __time_t for us.  */
-
-/* POSIX.1b structure for a time value.  This is like a `struct timeval' but
-   has nanoseconds instead of microseconds.  */
-struct timespec
-  {
-    __time_t tv_sec;		/* Seconds.  */
-    __syscall_slong_t tv_nsec;	/* Nanoseconds.  */
-  };
-
-#endif /* timespec not defined and <time.h> or need timespec.  */
-#undef	__need_timespec
-
-
-#ifdef	_TIME_H
-__BEGIN_NAMESPACE_STD
-/* Used by other time functions.  */
-struct tm
-{
-  int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
-  int tm_min;			/* Minutes.	[0-59] */
-  int tm_hour;			/* Hours.	[0-23] */
-  int tm_mday;			/* Day.		[1-31] */
-  int tm_mon;			/* Month.	[0-11] */
-  int tm_year;			/* Year	- 1900.  */
-  int tm_wday;			/* Day of week.	[0-6] */
-  int tm_yday;			/* Days in year.[0-365]	*/
-  int tm_isdst;			/* DST.		[-1/0/1]*/
-
-# ifdef	__USE_MISC
-  long int tm_gmtoff;		/* Seconds east of UTC.  */
-  const char *tm_zone;		/* Timezone abbreviation.  */
-# else
-  long int __tm_gmtoff;		/* Seconds east of UTC.  */
-  const char *__tm_zone;	/* Timezone abbreviation.  */
-# endif
-};
-__END_NAMESPACE_STD
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(tm)
+#if defined __USE_POSIX199309 || defined __USE_ISOC11
+# include <bits/types/struct_timespec.h>
 #endif
 
-
-# ifdef __USE_POSIX199309
-/* POSIX.1b structure for timer start values and intervals.  */
-struct itimerspec
-  {
-    struct timespec it_interval;
-    struct timespec it_value;
-  };
-
-/* We can use a simple forward declaration.  */
+#ifdef __USE_POSIX199309
+# include <bits/types/clockid_t.h>
+# include <bits/types/timer_t.h>
+# include <bits/types/struct_itimerspec.h>
 struct sigevent;
+#endif
 
-# endif	/* POSIX.1b */
-
-# ifdef __USE_XOPEN2K
-#  ifndef __pid_t_defined
+#ifdef __USE_XOPEN2K
+# ifndef __pid_t_defined
 typedef __pid_t pid_t;
-#   define __pid_t_defined
-#  endif
+#  define __pid_t_defined
 # endif
+#endif
 
+#ifdef __USE_XOPEN2K8
+# include <xlocale.h>
+#endif
 
-# ifdef __USE_ISOC11
+#ifdef __USE_ISOC11
 /* Time base values for timespec_get.  */
 # define TIME_UTC 1
-# endif
+#endif
 
+__BEGIN_DECLS
 
 __BEGIN_NAMESPACE_STD
 /* Time used by the program so far (user time + system time).
@@ -207,30 +91,29 @@ extern size_t strftime (char *__restrict __s, size_t __maxsize,
 			const struct tm *__restrict __tp) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_XOPEN
+#ifdef __USE_XOPEN
 /* Parse S according to FORMAT and store binary time information in TP.
    The return value is a pointer to the first unparsed character in S.  */
 extern char *strptime (const char *__restrict __s,
 		       const char *__restrict __fmt, struct tm *__tp)
      __THROW;
-# endif
+#endif
 
-# ifdef __USE_XOPEN2K8
+#ifdef __USE_XOPEN2K8
 /* Similar to the two functions above but take the information from
    the provided locale and not the global locale.  */
-# include <xlocale.h>
 
 extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
 			  const char *__restrict __format,
 			  const struct tm *__restrict __tp,
 			  __locale_t __loc) __THROW;
-# endif
+#endif
 
-# ifdef __USE_GNU
+#ifdef __USE_GNU
 extern char *strptime_l (const char *__restrict __s,
 			 const char *__restrict __fmt, struct tm *__tp,
 			 __locale_t __loc) __THROW;
-# endif
+#endif
 
 
 __BEGIN_NAMESPACE_STD
@@ -243,7 +126,7 @@ extern struct tm *gmtime (const time_t *__timer) __THROW;
 extern struct tm *localtime (const time_t *__timer) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_POSIX
+#ifdef __USE_POSIX
 /* Return the `struct tm' representation of *TIMER in UTC,
    using *TP to store the result.  */
 extern struct tm *gmtime_r (const time_t *__restrict __timer,
@@ -253,7 +136,7 @@ extern struct tm *gmtime_r (const time_t *__restrict __timer,
    using *TP to store the result.  */
 extern struct tm *localtime_r (const time_t *__restrict __timer,
 			       struct tm *__restrict __tp) __THROW;
-# endif	/* POSIX */
+#endif	/* POSIX */
 
 __BEGIN_NAMESPACE_STD
 /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -264,7 +147,7 @@ extern char *asctime (const struct tm *__tp) __THROW;
 extern char *ctime (const time_t *__timer) __THROW;
 __END_NAMESPACE_STD
 
-# ifdef __USE_POSIX
+#ifdef __USE_POSIX
 /* Reentrant versions of the above functions.  */
 
 /* Return in BUF a string of the form "Day Mon dd hh:mm:ss yyyy\n"
@@ -275,7 +158,7 @@ extern char *asctime_r (const struct tm *__restrict __tp,
 /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'.  */
 extern char *ctime_r (const time_t *__restrict __timer,
 		      char *__restrict __buf) __THROW;
-# endif	/* POSIX */
+#endif	/* POSIX */
 
 
 /* Defined in localtime.c.  */
@@ -284,34 +167,34 @@ extern int __daylight;		/* If daylight-saving time is ever in use.  */
 extern long int __timezone;	/* Seconds west of UTC.  */
 
 
-# ifdef	__USE_POSIX
+#ifdef	__USE_POSIX
 /* Same as above.  */
 extern char *tzname[2];
 
 /* Set time conversion information from the TZ environment variable.
    If TZ is not defined, a locale-dependent default is used.  */
 extern void tzset (void) __THROW;
-# endif
+#endif
 
-# if defined __USE_MISC || defined __USE_XOPEN
+#if defined __USE_MISC || defined __USE_XOPEN
 extern int daylight;
 extern long int timezone;
-# endif
+#endif
 
-# ifdef __USE_MISC
+#ifdef __USE_MISC
 /* Set the system time to *WHEN.
    This call is restricted to the superuser.  */
 extern int stime (const time_t *__when) __THROW;
-# endif
+#endif
 
 
 /* Nonzero if YEAR is a leap year (every 4 years,
    except every 100th isn't, and every 400th is).  */
-# define __isleap(year)	\
+#define __isleap(year)	\
   ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
 
 
-# ifdef __USE_MISC
+#ifdef __USE_MISC
 /* Miscellaneous functions many Unices inherited from the public domain
    localtime package.  These are included only for compatibility.  */
 
@@ -323,10 +206,10 @@ extern time_t timelocal (struct tm *__tp) __THROW;
 
 /* Return the number of days in YEAR.  */
 extern int dysize (int __year) __THROW  __attribute__ ((__const__));
-# endif
+#endif
 
 
-# ifdef __USE_POSIX199309
+#ifdef __USE_POSIX199309
 /* Pause execution for a number of nanoseconds.
 
    This function is a cancellation point and therefore not marked with
@@ -345,7 +228,7 @@ extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __THROW;
 extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
      __THROW;
 
-#  ifdef __USE_XOPEN2K
+# ifdef __USE_XOPEN2K
 /* High-resolution sleep with the specified clock.
 
    This function is a cancellation point and therefore not marked with
@@ -356,7 +239,7 @@ extern int clock_nanosleep (clockid_t __clock_id, int __flags,
 
 /* Return clock ID for CPU-time clock.  */
 extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
-#  endif
+# endif
 
 
 /* Create new per-process timer using CLOCK_ID.  */
@@ -378,17 +261,17 @@ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
 
 /* Get expiration overrun for timer TIMERID.  */
 extern int timer_getoverrun (timer_t __timerid) __THROW;
-# endif
+#endif
 
 
-# ifdef __USE_ISOC11
+#ifdef __USE_ISOC11
 /* Set TS to calendar time based in time base BASE.  */
 extern int timespec_get (struct timespec *__ts, int __base)
      __THROW __nonnull ((1));
-# endif
+#endif
 
 
-# ifdef __USE_XOPEN_EXTENDED
+#ifdef __USE_XOPEN_EXTENDED
 /* Set to one of the following values to indicate an error.
      1  the DATEMSK environment variable is null or undefined,
      2  the template file cannot be opened for reading,
@@ -410,9 +293,9 @@ extern int getdate_err;
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern struct tm *getdate (const char *__string);
-# endif
+#endif
 
-# ifdef __USE_GNU
+#ifdef __USE_GNU
 /* Since `getdate' is not reentrant because of the use of `getdate_err'
    and the static buffer to return the result in, we provide a thread-safe
    variant.  The functionality is the same.  The result is returned in
@@ -425,10 +308,8 @@ extern struct tm *getdate (const char *__string);
    therefore not marked with __THROW.  */
 extern int getdate_r (const char *__restrict __string,
 		      struct tm *__restrict __resbufp);
-# endif
+#endif
 
 __END_DECLS
 
-#endif /* <time.h> included.  */
-
-#endif /* <time.h> not already included.  */
+#endif /* time.h.  */