annotate lib/time.in.h @ 112430:78c4c9559156

* lisp/emacs-lisp/copyright.el (copyright-fix-years): Use copyright-find-copyright.
author Glenn Morris <rgm@gnu.org>
date Sat, 22 Jan 2011 14:13:17 -0800
parents 474d5026a5a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
112308
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 /* A more-standard <time.h>.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
3 Copyright (C) 2007-2011 Free Software Foundation, Inc.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 This program is free software; you can redistribute it and/or modify
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7 the Free Software Foundation; either version 3, or (at your option)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 any later version.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 GNU General Public License for more details.
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16 along with this program; if not, write to the Free Software Foundation,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19 #if __GNUC__ >= 3
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20 @PRAGMA_SYSTEM_HEADER@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 #endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
22 @PRAGMA_COLUMNS@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
23
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
24 /* Don't get in the way of glibc when it includes time.h merely to
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25 declare a few standard symbols, rather than to declare all the
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
26 symbols. Also, Solaris 8 <time.h> eventually includes itself
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
27 recursively; if that is happening, just include the system <time.h>
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
28 without adding our own declarations. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
29 #if (defined __need_time_t || defined __need_clock_t \
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
30 || defined __need_timespec \
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
31 || defined _GL_TIME_H)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
32
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
33 # @INCLUDE_NEXT@ @NEXT_TIME_H@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
34
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
35 #else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
36
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37 # define _GL_TIME_H
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
38
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
39 # @INCLUDE_NEXT@ @NEXT_TIME_H@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
40
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
41 /* NetBSD 5.0 mis-defines NULL. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
42 # include <stddef.h>
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
43
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
45
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
46 /* The definition of _GL_ARG_NONNULL is copied here. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
47
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
48 /* The definition of _GL_WARN_ON_USE is copied here. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
49
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
50 /* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
51 Or they define it with the wrong member names or define it in <sys/time.h>
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
52 (e.g., FreeBSD circa 1997). Stock Mingw does not define it, but the
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
53 pthreads-win32 library defines it in <pthread.h>. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
54 # if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
55 # if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
56 # include <sys/time.h>
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
57 # elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
58 # include <pthread.h>
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
59 /* The pthreads-win32 <pthread.h> also defines a couple of broken macros. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
60 # undef asctime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
61 # undef ctime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
62 # undef gmtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
63 # undef localtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
64 # undef rand_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
65 # undef strtok_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
66 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
67
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
68 # ifdef __cplusplus
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
69 extern "C" {
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
70 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
71
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
72 # undef timespec
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
73 # define timespec rpl_timespec
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
74 struct timespec
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
75 {
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
76 time_t tv_sec;
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
77 long int tv_nsec;
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
78 };
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
79
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
80 # ifdef __cplusplus
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
81 }
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
82 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
83
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
84 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
85 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
86
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
87 /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
88 time_t to be an integer type, even though C99 permits floating
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
89 point. We don't know of any implementation that uses floating
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
90 point, and it is much easier to write code that doesn't have to
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
91 worry about that corner case, so we force the issue. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
92 struct __time_t_must_be_integral {
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
93 unsigned int __floating_time_t_unsupported : (time_t) 1;
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
94 };
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
95
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
96 /* Sleep for at least RQTP seconds unless interrupted, If interrupted,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
97 return -1 and store the remaining time into RMTP. See
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
98 <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
99 # if @GNULIB_NANOSLEEP@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
100 # if @REPLACE_NANOSLEEP@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
101 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
102 # define nanosleep rpl_nanosleep
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
103 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
104 _GL_FUNCDECL_RPL (nanosleep, int,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
105 (struct timespec const *__rqtp, struct timespec *__rmtp)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
106 _GL_ARG_NONNULL ((1)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
107 _GL_CXXALIAS_RPL (nanosleep, int,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
108 (struct timespec const *__rqtp, struct timespec *__rmtp));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
109 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
110 # if ! @HAVE_NANOSLEEP@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
111 _GL_FUNCDECL_SYS (nanosleep, int,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
112 (struct timespec const *__rqtp, struct timespec *__rmtp)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
113 _GL_ARG_NONNULL ((1)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
114 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
115 _GL_CXXALIAS_SYS (nanosleep, int,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
116 (struct timespec const *__rqtp, struct timespec *__rmtp));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
117 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
118 _GL_CXXALIASWARN (nanosleep);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
119 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
120
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
121 /* Return the 'time_t' representation of TP and normalize TP. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
122 # if @GNULIB_MKTIME@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
123 # if @REPLACE_MKTIME@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
124 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
125 # define mktime rpl_mktime
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
126 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
127 _GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
128 _GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
129 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
130 _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
131 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
132 _GL_CXXALIASWARN (mktime);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
133 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
134
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
135 /* Convert TIMER to RESULT, assuming local time and UTC respectively. See
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
136 <http://www.opengroup.org/susv3xsh/localtime_r.html> and
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
137 <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
138 # if @GNULIB_TIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
139 # if @REPLACE_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
140 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
141 # undef localtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
142 # define localtime_r rpl_localtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
143 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
144 _GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
145 struct tm *restrict __result)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
146 _GL_ARG_NONNULL ((1, 2)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
147 _GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
148 struct tm *restrict __result));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
149 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
150 # if ! @HAVE_DECL_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
151 _GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
152 struct tm *restrict __result)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
153 _GL_ARG_NONNULL ((1, 2)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
154 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
155 _GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
156 struct tm *restrict __result));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
157 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
158 # if @HAVE_DECL_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
159 _GL_CXXALIASWARN (localtime_r);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
160 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
161 # if @REPLACE_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
162 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
163 # undef gmtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
164 # define gmtime_r rpl_gmtime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
165 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
166 _GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
167 struct tm *restrict __result)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
168 _GL_ARG_NONNULL ((1, 2)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
169 _GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
170 struct tm *restrict __result));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
171 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
172 # if ! @HAVE_DECL_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
173 _GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
174 struct tm *restrict __result)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
175 _GL_ARG_NONNULL ((1, 2)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
176 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
177 _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
178 struct tm *restrict __result));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
179 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
180 # if @HAVE_DECL_LOCALTIME_R@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
181 _GL_CXXALIASWARN (gmtime_r);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
182 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
183 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
184
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
185 /* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
186 the resulting broken-down time into TM. See
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
187 <http://www.opengroup.org/susv3xsh/strptime.html>. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
188 # if @GNULIB_STRPTIME@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
189 # if ! @HAVE_STRPTIME@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
190 _GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
191 char const *restrict __format,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
192 struct tm *restrict __tm)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
193 _GL_ARG_NONNULL ((1, 2, 3)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
194 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
195 _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
196 char const *restrict __format,
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
197 struct tm *restrict __tm));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
198 _GL_CXXALIASWARN (strptime);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
199 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
200
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
201 /* Convert TM to a time_t value, assuming UTC. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
202 # if @GNULIB_TIMEGM@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
203 # if @REPLACE_TIMEGM@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
204 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
205 # undef timegm
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
206 # define timegm rpl_timegm
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
207 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
208 _GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
209 _GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
210 # else
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
211 # if ! @HAVE_TIMEGM@
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
212 _GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1)));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
213 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
214 _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
215 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
216 _GL_CXXALIASWARN (timegm);
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
217 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
218
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
219 /* Encourage applications to avoid unsafe functions that can overrun
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
220 buffers when given outlandish struct tm values. Portable
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
221 applications should use strftime (or even sprintf) instead. */
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
222 # if defined GNULIB_POSIXCHECK
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
223 # undef asctime
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
224 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
225 "better use strftime (or even sprintf) instead");
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
226 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
227 # if defined GNULIB_POSIXCHECK
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
228 # undef asctime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
229 _GL_WARN_ON_USE (asctime, "asctime_r can overrun buffers in some cases - "
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
230 "better use strftime (or even sprintf) instead");
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
231 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
232 # if defined GNULIB_POSIXCHECK
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
233 # undef ctime
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
234 _GL_WARN_ON_USE (asctime, "ctime can overrun buffers in some cases - "
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
235 "better use strftime (or even sprintf) instead");
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
236 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
237 # if defined GNULIB_POSIXCHECK
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
238 # undef ctime_r
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
239 _GL_WARN_ON_USE (asctime, "ctime_r can overrun buffers in some cases - "
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
240 "better use strftime (or even sprintf) instead");
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
241 # endif
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
242
474d5026a5a2 Regenerate.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
243 #endif