61
86
/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
62
87
return -1 and store the remaining time into RMTP. See
63
88
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */
64
# if @REPLACE_NANOSLEEP@
65
# define nanosleep rpl_nanosleep
66
int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
89
# if @GNULIB_NANOSLEEP@
90
# if @REPLACE_NANOSLEEP@
91
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
92
# define nanosleep rpl_nanosleep
94
_GL_FUNCDECL_RPL (nanosleep, int,
95
(struct timespec const *__rqtp, struct timespec *__rmtp)
96
_GL_ARG_NONNULL ((1)));
97
_GL_CXXALIAS_RPL (nanosleep, int,
98
(struct timespec const *__rqtp, struct timespec *__rmtp));
100
# if ! @HAVE_NANOSLEEP@
101
_GL_FUNCDECL_SYS (nanosleep, int,
102
(struct timespec const *__rqtp, struct timespec *__rmtp)
103
_GL_ARG_NONNULL ((1)));
105
_GL_CXXALIAS_SYS (nanosleep, int,
106
(struct timespec const *__rqtp, struct timespec *__rmtp));
108
_GL_CXXALIASWARN (nanosleep);
111
/* Return the 'time_t' representation of TP and normalize TP. */
113
# if @REPLACE_MKTIME@
114
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
115
# define mktime rpl_mktime
117
_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
118
_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
120
_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
122
_GL_CXXALIASWARN (mktime);
69
125
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
70
126
<http://www.opengroup.org/susv3xsh/localtime_r.html> and
71
127
<http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
72
# if @REPLACE_LOCALTIME_R@
74
# define localtime_r rpl_localtime_r
76
# define gmtime_r rpl_gmtime_r
77
struct tm *localtime_r (time_t const *restrict __timer,
78
struct tm *restrict __result);
79
struct tm *gmtime_r (time_t const *restrict __timer,
80
struct tm *restrict __result);
129
# if @REPLACE_LOCALTIME_R@
130
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
132
# define localtime_r rpl_localtime_r
134
_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
135
struct tm *restrict __result)
136
_GL_ARG_NONNULL ((1, 2)));
137
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
138
struct tm *restrict __result));
140
# if ! @HAVE_LOCALTIME_R@
141
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
142
struct tm *restrict __result)
143
_GL_ARG_NONNULL ((1, 2)));
145
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
146
struct tm *restrict __result));
148
_GL_CXXALIASWARN (localtime_r);
149
# if @REPLACE_LOCALTIME_R@
150
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
152
# define gmtime_r rpl_gmtime_r
154
_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
155
struct tm *restrict __result)
156
_GL_ARG_NONNULL ((1, 2)));
157
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
158
struct tm *restrict __result));
160
# if ! @HAVE_LOCALTIME_R@
161
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
162
struct tm *restrict __result)
163
_GL_ARG_NONNULL ((1, 2)));
165
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
166
struct tm *restrict __result));
168
_GL_CXXALIASWARN (gmtime_r);
83
171
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
84
172
the resulting broken-down time into TM. See
85
173
<http://www.opengroup.org/susv3xsh/strptime.html>. */
86
# if @REPLACE_STRPTIME@
88
# define strptime rpl_strptime
89
char *strptime (char const *restrict __buf, char const *restrict __format,
90
struct tm *restrict __tm);
174
# if @GNULIB_STRPTIME@
175
# if ! @HAVE_STRPTIME@
176
_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
177
char const *restrict __format,
178
struct tm *restrict __tm)
179
_GL_ARG_NONNULL ((1, 2, 3)));
181
_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
182
char const *restrict __format,
183
struct tm *restrict __tm));
184
_GL_CXXALIASWARN (strptime);
93
187
/* Convert TM to a time_t value, assuming UTC. */
96
# define timegm rpl_timegm
97
time_t timegm (struct tm *__tm);
189
# if @REPLACE_TIMEGM@
190
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
192
# define timegm rpl_timegm
194
_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
195
_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
198
_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
200
_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
202
_GL_CXXALIASWARN (timegm);
100
205
/* Encourage applications to avoid unsafe functions that can overrun
101
206
buffers when given outlandish struct tm values. Portable
102
207
applications should use strftime (or even sprintf) instead. */
103
# if GNULIB_PORTCHECK
208
# if defined GNULIB_POSIXCHECK
105
# define asctime eschew_asctime
210
_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
211
"better use strftime (or even sprintf) instead");
213
# if defined GNULIB_POSIXCHECK
106
214
# undef asctime_r
107
# define asctime_r eschew_asctime_r
215
_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
216
"better use strftime (or even sprintf) instead");
218
# if defined GNULIB_POSIXCHECK
109
# define ctime eschew_ctime
220
_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
221
"better use strftime (or even sprintf) instead");
223
# if defined GNULIB_POSIXCHECK
111
# define ctime_r eschew_ctime_r
225
_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
226
"better use strftime (or even sprintf) instead");