summaryrefslogtreecommitdiffstats
path: root/gl/time.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/time.in.h')
-rw-r--r--gl/time.in.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/gl/time.in.h b/gl/time.in.h
index 6fb4fd7..8ced794 100644
--- a/gl/time.in.h
+++ b/gl/time.in.h
@@ -1,6 +1,6 @@
1/* A more-standard <time.h>. 1/* A more-standard <time.h>.
2 2
3 Copyright (C) 2007-2010 Free Software Foundation, Inc. 3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -13,12 +13,12 @@
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation, 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 17
19#if __GNUC__ >= 3 18#if __GNUC__ >= 3
20@PRAGMA_SYSTEM_HEADER@ 19@PRAGMA_SYSTEM_HEADER@
21#endif 20#endif
21@PRAGMA_COLUMNS@
22 22
23/* Don't get in the way of glibc when it includes time.h merely to 23/* Don't get in the way of glibc when it includes time.h merely to
24 declare a few standard symbols, rather than to declare all the 24 declare a few standard symbols, rather than to declare all the
@@ -27,13 +27,13 @@
27 without adding our own declarations. */ 27 without adding our own declarations. */
28#if (defined __need_time_t || defined __need_clock_t \ 28#if (defined __need_time_t || defined __need_clock_t \
29 || defined __need_timespec \ 29 || defined __need_timespec \
30 || defined _GL_TIME_H) 30 || defined _@GUARD_PREFIX@_TIME_H)
31 31
32# @INCLUDE_NEXT@ @NEXT_TIME_H@ 32# @INCLUDE_NEXT@ @NEXT_TIME_H@
33 33
34#else 34#else
35 35
36# define _GL_TIME_H 36# define _@GUARD_PREFIX@_TIME_H
37 37
38# @INCLUDE_NEXT@ @NEXT_TIME_H@ 38# @INCLUDE_NEXT@ @NEXT_TIME_H@
39 39
@@ -68,13 +68,16 @@
68extern "C" { 68extern "C" {
69# endif 69# endif
70 70
71# undef timespec 71# if !GNULIB_defined_struct_timespec
72# define timespec rpl_timespec 72# undef timespec
73# define timespec rpl_timespec
73struct timespec 74struct timespec
74{ 75{
75 time_t tv_sec; 76 time_t tv_sec;
76 long int tv_nsec; 77 long int tv_nsec;
77}; 78};
79# define GNULIB_defined_struct_timespec 1
80# endif
78 81
79# ifdef __cplusplus 82# ifdef __cplusplus
80} 83}
@@ -83,6 +86,18 @@ struct timespec
83# endif 86# endif
84# endif 87# endif
85 88
89# if !GNULIB_defined_struct_time_t_must_be_integral
90/* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
91 time_t to be an integer type, even though C99 permits floating
92 point. We don't know of any implementation that uses floating
93 point, and it is much easier to write code that doesn't have to
94 worry about that corner case, so we force the issue. */
95struct __time_t_must_be_integral {
96 unsigned int __floating_time_t_unsupported : (time_t) 1;
97};
98# define GNULIB_defined_struct_time_t_must_be_integral 1
99# endif
100
86/* Sleep for at least RQTP seconds unless interrupted, If interrupted, 101/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
87 return -1 and store the remaining time into RMTP. See 102 return -1 and store the remaining time into RMTP. See
88 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */ 103 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
@@ -137,7 +152,7 @@ _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
137_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, 152_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
138 struct tm *restrict __result)); 153 struct tm *restrict __result));
139# else 154# else
140# if ! @HAVE_LOCALTIME_R@ 155# if ! @HAVE_DECL_LOCALTIME_R@
141_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 156_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
142 struct tm *restrict __result) 157 struct tm *restrict __result)
143 _GL_ARG_NONNULL ((1, 2))); 158 _GL_ARG_NONNULL ((1, 2)));
@@ -145,7 +160,9 @@ _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
145_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, 160_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
146 struct tm *restrict __result)); 161 struct tm *restrict __result));
147# endif 162# endif
163# if @HAVE_DECL_LOCALTIME_R@
148_GL_CXXALIASWARN (localtime_r); 164_GL_CXXALIASWARN (localtime_r);
165# endif
149# if @REPLACE_LOCALTIME_R@ 166# if @REPLACE_LOCALTIME_R@
150# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 167# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
151# undef gmtime_r 168# undef gmtime_r
@@ -157,7 +174,7 @@ _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
157_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, 174_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
158 struct tm *restrict __result)); 175 struct tm *restrict __result));
159# else 176# else
160# if ! @HAVE_LOCALTIME_R@ 177# if ! @HAVE_DECL_LOCALTIME_R@
161_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 178_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
162 struct tm *restrict __result) 179 struct tm *restrict __result)
163 _GL_ARG_NONNULL ((1, 2))); 180 _GL_ARG_NONNULL ((1, 2)));
@@ -165,7 +182,9 @@ _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
165_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, 182_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
166 struct tm *restrict __result)); 183 struct tm *restrict __result));
167# endif 184# endif
185# if @HAVE_DECL_LOCALTIME_R@
168_GL_CXXALIASWARN (gmtime_r); 186_GL_CXXALIASWARN (gmtime_r);
187# endif
169# endif 188# endif
170 189
171/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store 190/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store