]> git.cworth.org Git - tar/blob - gnu/time.in.h
816f732209eabd8224714bf8695441db995d58df
[tar] / gnu / time.in.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* A more-standard <time.h>.
4
5    Copyright (C) 2007-2010 Free Software Foundation, Inc.
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3, or (at your option)
10    any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software Foundation,
19    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20
21 #if __GNUC__ >= 3
22 @PRAGMA_SYSTEM_HEADER@
23 #endif
24
25 /* Don't get in the way of glibc when it includes time.h merely to
26    declare a few standard symbols, rather than to declare all the
27    symbols.  Also, Solaris 8 <time.h> eventually includes itself
28    recursively; if that is happening, just include the system <time.h>
29    without adding our own declarations.  */
30 #if (defined __need_time_t || defined __need_clock_t \
31      || defined __need_timespec \
32      || defined _GL_TIME_H)
33
34 # @INCLUDE_NEXT@ @NEXT_TIME_H@
35
36 #else
37
38 # define _GL_TIME_H
39
40 # @INCLUDE_NEXT@ @NEXT_TIME_H@
41
42 /* NetBSD 5.0 mis-defines NULL.  */
43 #include <stddef.h>
44
45 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
46
47 /* The definition of _GL_ARG_NONNULL is copied here.  */
48
49 /* The definition of _GL_WARN_ON_USE is copied here.  */
50
51 # ifdef __cplusplus
52 extern "C" {
53 # endif
54
55 /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
56    Or they define it with the wrong member names or define it in <sys/time.h>
57    (e.g., FreeBSD circa 1997).  */
58 # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
59 #  if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
60 #   include <sys/time.h>
61 #  else
62 #   undef timespec
63 #   define timespec rpl_timespec
64 struct timespec
65 {
66   time_t tv_sec;
67   long int tv_nsec;
68 };
69 #  endif
70 # endif
71
72 # ifdef __cplusplus
73 }
74 # endif
75
76 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
77    return -1 and store the remaining time into RMTP.  See
78    <http://www.opengroup.org/susv3xsh/nanosleep.html>.  */
79 # if @GNULIB_NANOSLEEP@
80 #  if @REPLACE_NANOSLEEP@
81 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
82 #    define nanosleep rpl_nanosleep
83 #   endif
84 _GL_FUNCDECL_RPL (nanosleep, int,
85                   (struct timespec const *__rqtp, struct timespec *__rmtp)
86                   _GL_ARG_NONNULL ((1)));
87 _GL_CXXALIAS_RPL (nanosleep, int,
88                   (struct timespec const *__rqtp, struct timespec *__rmtp));
89 #  else
90 _GL_CXXALIAS_SYS (nanosleep, int,
91                   (struct timespec const *__rqtp, struct timespec *__rmtp));
92 #  endif
93 _GL_CXXALIASWARN (nanosleep);
94 # endif
95
96 /* Return the 'time_t' representation of TP and normalize TP.  */
97 # if @GNULIB_MKTIME@
98 #  if @REPLACE_MKTIME@
99 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
100 #    define mktime rpl_mktime
101 #   endif
102 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
103 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
104 #  else
105 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
106 #  endif
107 _GL_CXXALIASWARN (mktime);
108 # endif
109
110 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
111    <http://www.opengroup.org/susv3xsh/localtime_r.html> and
112    <http://www.opengroup.org/susv3xsh/gmtime_r.html>.  */
113 # if @REPLACE_LOCALTIME_R@
114 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
115 #   undef localtime_r
116 #   define localtime_r rpl_localtime_r
117 #  endif
118 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
119                                              struct tm *restrict __result)
120                                             _GL_ARG_NONNULL ((1, 2)));
121 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
122                                              struct tm *restrict __result));
123 # else
124 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
125                                              struct tm *restrict __result));
126 # endif
127 _GL_CXXALIASWARN (localtime_r);
128 # if @REPLACE_LOCALTIME_R@
129 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
130 #   undef gmtime_r
131 #   define gmtime_r rpl_gmtime_r
132 #  endif
133 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
134                                           struct tm *restrict __result)
135                                          _GL_ARG_NONNULL ((1, 2)));
136 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
137                                           struct tm *restrict __result));
138 # else
139 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
140                                           struct tm *restrict __result));
141 # endif
142 _GL_CXXALIASWARN (gmtime_r);
143
144 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
145    the resulting broken-down time into TM.  See
146    <http://www.opengroup.org/susv3xsh/strptime.html>.  */
147 # if @GNULIB_STRPTIME@
148 #  if @REPLACE_STRPTIME@
149 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
150 #    undef strptime
151 #    define strptime rpl_strptime
152 #   endif
153 _GL_FUNCDECL_RPL (strptime, char *, (char const *restrict __buf,
154                                      char const *restrict __format,
155                                      struct tm *restrict __tm)
156                                     _GL_ARG_NONNULL ((1, 2, 3)));
157 _GL_CXXALIAS_RPL (strptime, char *, (char const *restrict __buf,
158                                      char const *restrict __format,
159                                      struct tm *restrict __tm));
160 #  else
161 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
162                                      char const *restrict __format,
163                                      struct tm *restrict __tm));
164 #  endif
165 _GL_CXXALIASWARN (strptime);
166 # endif
167
168 /* Convert TM to a time_t value, assuming UTC.  */
169 # if @GNULIB_TIMEGM@
170 #  if @REPLACE_TIMEGM@
171 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
172 #    undef timegm
173 #    define timegm rpl_timegm
174 #   endif
175 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
176 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
177 #  else
178 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
179 #  endif
180 _GL_CXXALIASWARN (timegm);
181 # endif
182
183 /* Encourage applications to avoid unsafe functions that can overrun
184    buffers when given outlandish struct tm values.  Portable
185    applications should use strftime (or even sprintf) instead.  */
186 # if GNULIB_PORTCHECK
187 #  undef asctime
188 #  define asctime eschew_asctime
189 #  undef asctime_r
190 #  define asctime_r eschew_asctime_r
191 #  undef ctime
192 #  define ctime eschew_ctime
193 #  undef ctime_r
194 #  define ctime_r eschew_ctime_r
195 # endif
196
197 #endif