Installed-header hygiene (BZ#20366): time.h types.
authorZack Weinberg <zackw@panix.com>
Wed, 24 Aug 2016 15:54:34 +0000 (11:54 -0400)
committerZack Weinberg <zackw@panix.com>
Fri, 23 Sep 2016 12:43:56 +0000 (08:43 -0400)
Many headers are expected to expose a subset of the type definitions
in time.h.  time.h has a whole bunch of messy logic for conditionally
defining some its types and structs, but, as best I can tell, this
has never worked 100%.  In particular, __need_timespec is ineffective
if _TIME_H has already been defined, which means that if you compile

  #include <time.h>
  #include <sched.h>

with e.g. -fsyntax-only -std=c89 -Wall -Wsystem-headers, you will get

In file included from test.c:2:0:
/usr/include/sched.h:74:57: warning: "struct timespec" declared inside
  parameter list will not be visible outside of this definition or declaration
 extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
                                                         ^~~~~~~~

And if you want to _use_ sched_rr_get_interval in a TU compiled that
way, you're hosed.

This patch replaces all of that with small bits/types/TYPE.h headers
as introduced earlier.  time.h and bits/time.h are now *much* simpler,
and a lot of other headers are slightly simpler.

* 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.

51 files changed:
ChangeLog
bits/resource.h
bits/time.h
include/bits/types/clock_t.h [new file with mode: 0644]
include/bits/types/clockid_t.h [new file with mode: 0644]
include/bits/types/struct_itimerspec.h [new file with mode: 0644]
include/bits/types/struct_timespec.h [new file with mode: 0644]
include/bits/types/struct_timeval.h [new file with mode: 0644]
include/bits/types/struct_tm.h [new file with mode: 0644]
include/bits/types/time_t.h [new file with mode: 0644]
include/bits/types/timer_t.h [new file with mode: 0644]
include/time.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
sysdeps/nptl/pthread.h
sysdeps/pthread/semaphore.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/time.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/Makefile
time/bits/types/clock_t.h [new file with mode: 0644]
time/bits/types/clockid_t.h [new file with mode: 0644]
time/bits/types/struct_itimerspec.h [new file with mode: 0644]
time/bits/types/struct_timespec.h [new file with mode: 0644]
time/bits/types/struct_timeval.h [new file with mode: 0644]
time/bits/types/struct_tm.h [new file with mode: 0644]
time/bits/types/time_t.h [new file with mode: 0644]
time/bits/types/timer_t.h [new file with mode: 0644]
time/sys/time.h
time/sys/timeb.h
time/time.h

index 60500b4..b428ba4 100644 (file)
--- 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
index 7d2d66c..5cd2fe5 100644 (file)
@@ -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
index 19c7ab0..84e0e94 100644 (file)
  * 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
 /* 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 (file)
index 0000000..a08940d
--- /dev/null
@@ -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 (file)
index 0000000..fb0a514
--- /dev/null
@@ -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 (file)
index 0000000..7d325d6
--- /dev/null
@@ -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 (file)
index 0000000..b8ec6a3
--- /dev/null
@@ -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 (file)
index 0000000..5d2cb78
--- /dev/null
@@ -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 (file)
index 0000000..b70ac52
--- /dev/null
@@ -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 (file)
index 0000000..16e75e1
--- /dev/null
@@ -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 (file)
index 0000000..e6b279b
--- /dev/null
@@ -0,0 +1 @@
+#include "../../time/bits/types/timer_t.h"
index 8dd10dc..684ceb8 100644 (file)
@@ -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
index cb706b4..12099a2 100644 (file)
@@ -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>
index e751860..58498b0 100644 (file)
@@ -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
 
 
index 6925f61..71462a7 100644 (file)
 
 #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
index 3cc0d5e..b30e1cc 100644 (file)
@@ -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.  */
index 52dd94f..2e4de40 100644 (file)
@@ -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;
index 253c963..5b431c6 100644 (file)
 #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;
index a877d14..c7308d2 100644 (file)
@@ -24,9 +24,7 @@
 
 #include <features.h>
 
-#define        __need_clock_t
-#include <time.h>
-
+#include <bits/types/clock_t.h>
 
 __BEGIN_DECLS
 
index 83dadcd..386f3e5 100644 (file)
@@ -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
index 3aba530..9a409c0 100644 (file)
@@ -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>
index 8cb6a5e..bc70082 100644 (file)
--- 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
 
index 9700cdc..db6022f 100644 (file)
@@ -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>
 
index 47e995a..2825386 100644 (file)
@@ -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
index fd0894e..cc6517b 100644 (file)
@@ -26,6 +26,7 @@
 #include <bits/pthreadtypes.h>
 #include <bits/setjmp.h>
 #include <bits/wordsize.h>
+#include <bits/types/struct_timespec.h>
 
 
 /* Detach state.  */
index 9927db7..5508267 100644 (file)
@@ -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.  */
index fbc8f5a..1c17605 100644 (file)
@@ -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
index 01da7bf..9fb9bdc 100644 (file)
@@ -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
 
index 8af0e0e..e2a62bc 100644 (file)
@@ -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.  */
 
index 87eb51f..1fade54 100644 (file)
  * 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 */
index 5eb7ccb..1bf6121 100644 (file)
@@ -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.  */
 
index 4ce5ff6..e3bcccf 100644 (file)
@@ -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
index f8924c4..5e492e9 100644 (file)
@@ -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>
 
index 305ca5e..c5eac6f 100644 (file)
@@ -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
index d24c2a7..bc8a08e 100644 (file)
@@ -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
 
index d037213..492c488 100644 (file)
@@ -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>
index 4dc559f..4499dc5 100644 (file)
@@ -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;
index 1b32092..3a79f9d 100644 (file)
@@ -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
index df263dc..41dc6c6 100644 (file)
@@ -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
index e052c07..326a81b 100644 (file)
@@ -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 (file)
index 0000000..b8cbaf2
--- /dev/null
@@ -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 (file)
index 0000000..b17c7da
--- /dev/null
@@ -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 (file)
index 0000000..17cc1ac
--- /dev/null
@@ -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 (file)
index 0000000..644db9f
--- /dev/null
@@ -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 (file)
index 0000000..70394ce
--- /dev/null
@@ -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 (file)
index 0000000..8f5af16
--- /dev/null
@@ -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 (file)
index 0000000..16e5269
--- /dev/null
@@ -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 (file)
index 0000000..d71a413
--- /dev/null
@@ -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
index 545de6f..89d574f 100644 (file)
 #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
 
index 41d71bf..1e7d0a9 100644 (file)
@@ -20,9 +20,7 @@
 
 #include <features.h>
 
-#define __need_time_t
-#include <time.h>
-
+#include <bits/types/time_t.h>
 
 __BEGIN_DECLS
 
index cc93917..c38fac7 100644 (file)
  */
 
 #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.  */