66
76
/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
67
77
return -1 and store the remaining time into RMTP. See
68
78
<http://www.opengroup.org/susv3xsh/nanosleep.html>. */
69
# if @REPLACE_NANOSLEEP@
70
# define nanosleep rpl_nanosleep
71
extern int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp)
72
_GL_ARG_NONNULL ((1));
79
# if @GNULIB_NANOSLEEP@
80
# if @REPLACE_NANOSLEEP@
81
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
82
# define nanosleep rpl_nanosleep
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));
90
# if ! @HAVE_NANOSLEEP@
91
_GL_FUNCDECL_SYS (nanosleep, int,
92
(struct timespec const *__rqtp, struct timespec *__rmtp)
93
_GL_ARG_NONNULL ((1)));
95
_GL_CXXALIAS_SYS (nanosleep, int,
96
(struct timespec const *__rqtp, struct timespec *__rmtp));
98
_GL_CXXALIASWARN (nanosleep);
75
101
/* Return the 'time_t' representation of TP and normalize TP. */
77
# define mktime rpl_mktime
78
extern time_t mktime (struct tm *__tp) _GL_ARG_NONNULL ((1));
103
# if @REPLACE_MKTIME@
104
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
105
# define mktime rpl_mktime
107
_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
108
_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
110
_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
112
_GL_CXXALIASWARN (mktime);
81
115
/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
82
116
<http://www.opengroup.org/susv3xsh/localtime_r.html> and
83
117
<http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
84
# if @REPLACE_LOCALTIME_R@
86
# define localtime_r rpl_localtime_r
88
# define gmtime_r rpl_gmtime_r
89
extern struct tm *localtime_r (time_t const *restrict __timer,
90
struct tm *restrict __result)
91
_GL_ARG_NONNULL ((1, 2));
92
extern struct tm *gmtime_r (time_t const *restrict __timer,
93
struct tm *restrict __result)
94
_GL_ARG_NONNULL ((1, 2));
119
# if @REPLACE_LOCALTIME_R@
120
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
122
# define localtime_r rpl_localtime_r
124
_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
125
struct tm *restrict __result)
126
_GL_ARG_NONNULL ((1, 2)));
127
_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
128
struct tm *restrict __result));
130
# if ! @HAVE_LOCALTIME_R@
131
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
132
struct tm *restrict __result)
133
_GL_ARG_NONNULL ((1, 2)));
135
_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
136
struct tm *restrict __result));
138
_GL_CXXALIASWARN (localtime_r);
139
# if @REPLACE_LOCALTIME_R@
140
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
142
# define gmtime_r rpl_gmtime_r
144
_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
145
struct tm *restrict __result)
146
_GL_ARG_NONNULL ((1, 2)));
147
_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
148
struct tm *restrict __result));
150
# if ! @HAVE_LOCALTIME_R@
151
_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
152
struct tm *restrict __result)
153
_GL_ARG_NONNULL ((1, 2)));
155
_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
156
struct tm *restrict __result));
158
_GL_CXXALIASWARN (gmtime_r);
97
161
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
98
162
the resulting broken-down time into TM. See
99
163
<http://www.opengroup.org/susv3xsh/strptime.html>. */
100
# if @REPLACE_STRPTIME@
102
# define strptime rpl_strptime
103
extern char *strptime (char const *restrict __buf,
104
char const *restrict __format,
105
struct tm *restrict __tm)
106
_GL_ARG_NONNULL ((1, 2, 3));
164
# if @GNULIB_STRPTIME@
165
# if ! @HAVE_STRPTIME@
166
_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
167
char const *restrict __format,
168
struct tm *restrict __tm)
169
_GL_ARG_NONNULL ((1, 2, 3)));
171
_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
172
char const *restrict __format,
173
struct tm *restrict __tm));
174
_GL_CXXALIASWARN (strptime);
109
177
/* Convert TM to a time_t value, assuming UTC. */
110
# if @REPLACE_TIMEGM@
112
# define timegm rpl_timegm
113
extern time_t timegm (struct tm *__tm) _GL_ARG_NONNULL ((1));
179
# if @REPLACE_TIMEGM@
180
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
182
# define timegm rpl_timegm
184
_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
185
_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
188
_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
190
_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
192
_GL_CXXALIASWARN (timegm);
116
195
/* Encourage applications to avoid unsafe functions that can overrun
117
196
buffers when given outlandish struct tm values. Portable
118
197
applications should use strftime (or even sprintf) instead. */
119
# if GNULIB_PORTCHECK
198
# if defined GNULIB_POSIXCHECK
121
# define asctime eschew_asctime
200
_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
201
"better use strftime (or even sprintf) instead");
203
# if defined GNULIB_POSIXCHECK
122
204
# undef asctime_r
123
# define asctime_r eschew_asctime_r
205
_GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
206
"better use strftime (or even sprintf) instead");
208
# if defined GNULIB_POSIXCHECK
125
# define ctime eschew_ctime
210
_GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
211
"better use strftime (or even sprintf) instead");
213
# if defined GNULIB_POSIXCHECK
127
# define ctime_r eschew_ctime_r
215
_GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
216
"better use strftime (or even sprintf) instead");