diff --git a/include/bits/types/struct___timespec64.h b/include/bits/types/struct___timespec64.h
new file mode 100644
index 0000000000..5904500b5e
--- /dev/null
+++ b/include/bits/types/struct___timespec64.h
@@ -0,0 +1 @@
+#include <time/bits/types/struct___timespec64.h>
diff --git a/include/mqueue.h b/include/mqueue.h
index 98e4596c22..d2796ee086 100644
--- a/include/mqueue.h
+++ b/include/mqueue.h
@@ -10,7 +10,7 @@ extern __typeof (mq_timedreceive) __mq_timedreceive __nonnull ((2, 5));
 hidden_proto (__mq_timedreceive)
 hidden_proto (mq_setattr)
 # endif
-#include <struct___timespec64.h>
+#include <bits/types/struct___timespec64.h>
 #if __TIMESIZE == 64
 # define __mq_timedsend_time64 __mq_timedsend
 # define __mq_timedreceive_time64 __mq_timedreceive
diff --git a/include/signal.h b/include/signal.h
index 2a278697c1..545410c7d7 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -41,7 +41,7 @@ libc_hidden_proto (__sigwaitinfo)
 #if __TIMESIZE == 64
 # define __sigtimedwait64 __sigtimedwait
 #else
-# include <struct___timespec64.h>
+# include <bits/types/struct___timespec64.h>
 extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info,
 			     const struct __timespec64 *__timeout);
 libc_hidden_proto (__sigtimedwait64)
diff --git a/include/sys/select.h b/include/sys/select.h
index ec073deeba..ea25c7c181 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -7,7 +7,7 @@
 #  define __pselect64 __pselect
 #  define __select64  __select
 #else
-# include <struct___timespec64.h>
+# include <bits/types/struct___timespec64.h>
 # include <struct___timeval64.h>
 
 extern int __pselect64 (int __nfds, fd_set *__readfds,
diff --git a/include/sys/stat.h b/include/sys/stat.h
index 108cb0c9bf..8e6cc5ec74 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -3,7 +3,7 @@
 
 #ifndef _ISOMAC
 # include <xstatver.h>
-# include <struct___timespec64.h>
+# include <bits/types/struct___timespec64.h>
 # include <struct_stat_time64.h>
 # include <stdbool.h>
 
diff --git a/include/time.h b/include/time.h
index caf2af5e74..89170a1d3f 100644
--- a/include/time.h
+++ b/include/time.h
@@ -3,7 +3,7 @@
 
 #ifndef _ISOMAC
 # include <bits/types/struct_timeval.h>
-# include <struct___timespec64.h>
+# include <bits/types/struct___timespec64.h>
 # include <struct___timeval64.h>
 # include <bits/types/locale_t.h>
 # include <stdbool.h>
diff --git a/inet/net-internal.h b/inet/net-internal.h
index 50c7e1c482..6bbc02fd79 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -24,7 +24,7 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <libc-diag.h>
-#include <struct___timespec64.h>
+#include <bits/types/struct___timespec64.h>
 
 int __inet6_scopeid_pton (const struct in6_addr *address,
                           const char *scope, uint32_t *result);
diff --git a/login/logwtmp.c b/login/logwtmp.c
index 050219c153..96066ea560 100644
--- a/login/logwtmp.c
+++ b/login/logwtmp.c
@@ -21,7 +21,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <utmp.h>
-#include <struct___timespec64.h>
+#include <bits/types/struct___timespec64.h>
 
 
 void
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index 41c7937fcd..f40bcc7d7e 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -37,7 +37,7 @@
 #include <not-cancel.h>
 #include <kernel-features.h>
 #include <nss.h>
-#include <struct___timespec64.h>
+#include <bits/types/struct___timespec64.h>
 
 #include "nscd-client.h"
 
diff --git a/sysdeps/unix/sysv/linux/include/sys/sem.h b/sysdeps/unix/sysv/linux/include/sys/sem.h
index f369c6b6d3..41bc82fe55 100644
--- a/sysdeps/unix/sysv/linux/include/sys/sem.h
+++ b/sysdeps/unix/sysv/linux/include/sys/sem.h
@@ -9,7 +9,7 @@ __typeof__ (semtimedop) __semtimedop attribute_hidden;
 # define __semctl64 __semctl
 # define __semtimedop64 __semtimedop
 #else
-# include <struct___timespec64.h>
+# include <bits/types/struct___timespec64.h>
 
 extern int __semctl64 (int semid, int semnum, int cmd, ...);
 libc_hidden_proto (__semctl64);
diff --git a/time/Makefile b/time/Makefile
index f27a75a115..4d0a10a193 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -27,7 +27,8 @@ headers := time.h sys/time.h sys/timeb.h bits/time.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 bits/types/struct_timeb.h
+	   bits/types/time_t.h bits/types/struct_timeb.h		\
+	   bits/types/struct___timespec64.h
 
 routines := offtime asctime clock ctime ctime_r difftime \
 	    gmtime localtime mktime time		 \
diff --git a/include/struct___timespec64.h b/time/bits/types/struct___timespec64.h
similarity index 92%
rename from include/struct___timespec64.h
rename to time/bits/types/struct___timespec64.h
index 9abb25c8f7..ea164f9c41 100644
--- a/include/struct___timespec64.h
+++ b/time/bits/types/struct___timespec64.h
@@ -4,7 +4,7 @@
 #if __TIMESIZE == 64
 # define __timespec64 timespec
 #else
-#include <endian.h>
+#include <bits/endian.h>
 /* The glibc Y2038-proof struct __timespec64 structure for a time value.
    To keep things Posix-ish, we keep the nanoseconds field a 32-bit
    signed long, but since the Linux field is a 64-bit signed int, we
@@ -15,7 +15,7 @@
 struct __timespec64
 {
   __time64_t tv_sec;         /* Seconds */
-# if BYTE_ORDER == BIG_ENDIAN
+# if __BYTE_ORDER == __BIG_ENDIAN
   __int32_t :32;             /* Padding */
   __int32_t tv_nsec;         /* Nanoseconds */
 # else
diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h
index d11c69cfd3..bf0ee6c410 100644
--- a/time/bits/types/struct_timespec.h
+++ b/time/bits/types/struct_timespec.h
@@ -4,6 +4,7 @@
 
 #include <bits/types.h>
 #include <bits/endian.h>
+#include <bits/types/time_t.h>
 
 /* POSIX.1b structure for a time value.  This is like a `struct timeval' but
    has nanoseconds instead of microseconds.  */
@@ -25,4 +26,8 @@ struct timespec
 #endif
 };
 
+# if __TIMESIZE == 32 && defined __USE_TIME_BITS64
+#  include <bits/types/struct___timespec64.h>
+#  define timespec __timespec64
+# endif
 #endif
