OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / getdate.3
1 .\" Copyright 2001 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Modified, 2001-12-26, aeb
26 .\" 2008-09-07, mtk, Various rewrites; added an example program.
27 .\"
28 .\" Japanese Version Copyright (c) 2002 NAKANO Takeo
29 .\" and Copyright (c) 2008, Akihiro MOTOKI all rights reserved.
30 .\"
31 .\" Translated 2002-01-12, NAKANO Takeo <nakano@apm.seikei.ac.jp>
32 .\" Updated 2008-09-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.09
33 .\"
34 .\"WORD:        broken-down time        Í×ÁÇÊ̤λþ¹ï
35 .\"
36 .TH GETDATE 3 2010-09-20 "" "Linux Programmer's Manual"
37 .\"O .SH NAME
38 .SH Ì¾Á°
39 .\"O getdate, getdate_r \- convert a date-plus-time string to broken-down time
40 getdate, getdate_r \- ÆüÉդȻþ¹ï¤Îʸ»úÎó¤òÍ×ÁÇÊ̤λþ¹ï¤ËÊÑ´¹¤¹¤ë
41 .\"O .SH SYNOPSIS
42 .SH ½ñ¼°
43 .B "#include <time.h>"
44 .sp
45 .BI "struct tm *getdate(const char *" string );
46 .sp
47 .B "extern int getdate_err;"
48 .sp
49 .B "#include <time.h>"
50 .sp
51 .BI "int getdate_r(const char *" string ", struct tm *" res );
52 .sp
53 .in -4n
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
57 .RB ( feature_test_macros (7)
58 »²¾È):
59 .in
60 .sp
61 .BR getdate ():
62 .ad l
63 .RS 4
64 _XOPEN_SOURCE\ >=\ 500 ||
65 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
66 .RE
67 .br
68 .BR getdate_r ():
69 .ad l
70 .RS 4
71 _GNU_SOURCE
72 .RE
73 .ad
74 .\"O .SH DESCRIPTION
75 .SH ÀâÌÀ
76 .\"O The function
77 .\"O .BR getdate ()
78 .\"O converts a string representation of a date and time,
79 .\"O contained in the buffer pointed to by
80 .\"O .IR string ,
81 .\"O into a broken-down time.
82 .BR getdate ()
83 ´Ø¿ô¤Ï¡¢
84 .I string
85 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤¿Ê¸»úÎóɽ¸½¤ÎÆüÉդȻþ¹ï¤ò¡¢
86 Í×ÁÇÊ̤λþ¹ï (broken-down time) ¤ËÊÑ´¹¤¹¤ë¡£
87 .\"O The broken-down time is stored in a
88 .\"O .I tm
89 .\"O structure, and a pointer to this
90 .\"O structure is returned as the function result.
91 .\"O This
92 .\"O .I tm
93 .\"O structure is allocated in static storage,
94 .\"O and consequently it will be overwritten by further calls to
95 .\"O .BR getdate ().
96 Í×ÁÇÊ̤λþ¹ï¤Ï
97 .I tm
98 ¹½Â¤ÂΤ˳ÊǼ¤µ¤ì¡¢¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤¬´Ø¿ô¤Î·ë²Ì¤È¤·¤ÆÊÖ¤µ¤ì¤ë¡£
99 ¤³¤Î
100 .I tm
101 ¹½Â¤ÂΤÏÀÅŪ¤Ê¥á¥â¥êÎΰè¤Ë¤¢¤ê¡¢
102 .BR getdate ()
103 ¤Î¤½¤ì°Ê¹ß¤Î¸Æ¤Ó½Ð¤·¤Ç¾å½ñ¤­¤µ¤ì¤ë¤«¤â¤µ¤ì¤Ê¤¤¡£
104 .\"O
105 .PP
106 .\"O In contrast to
107 .\"O .BR strptime (3),
108 .\"O (which has a
109 .\"O .I format
110 .\"O argument),
111 .\"O .BR getdate ()
112 .\"O uses the formats found in the file
113 .\"O whose full pathname is given in the environment variable
114 .\"O .BR DATEMSK .
115 .\"O The first line in the file that matches the given input string
116 .\"O is used for the conversion.
117 .RI ( format
118 °ú¤­¿ô¤Ç¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë)
119 .BR strptime (3)
120 ¤È¤Ï°ã¤¤¡¢
121 .BR getdate ()
122 ¤Ï´Ä¶­ÊÑ¿ô
123 .B DATEMSK
124 ¤Ç»ØÄꤵ¤ì¤¿¥Õ¥ë¥Ñ¥¹Ì¾¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¤¤¤Æ¤¢¤ë¥Õ¥©¡¼¥Þ¥Ã¥È¤òÍѤ¤¤ë¡£
125 .\"O
126 .PP
127 .\"O The matching is done case insensitively.
128 .\"O Superfluous whitespace, either in the pattern or in the string to
129 .\"O be converted, is ignored.
130 ¥Þ¥Ã¥Á¤ÎºÝ¤Ë¤ÏÂçʸ»ú¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤¡£
131 ¥Ñ¥¿¡¼¥óÃæ¤Ç¤âÊÑ´¹¤µ¤ì¤ëʸ»úÎóÃæ¤Ç¤â¡¢Í¾Ê¬¤Ê¶õÇòʸ»ú¤Ï̵»ë¤µ¤ì¤ë¡£
132 .\"O
133 .PP
134 .\"O The conversion specifications that a pattern can contain are those given for
135 .\"O .BR strptime (3).
136 .\"O One more conversion specification is specified in POSIX.1-2001:
137 ¥Ñ¥¿¡¼¥ó¤Ë»ØÄê¤Ç¤­¤ëÊÑ´¹»ØÄê¤Ï¡¢
138 .BR strptime (3)
139 ¤Î¤â¤Î¤ÈƱ¤¸¤Ç¤¢¤ë¡£
140 POSIX.1-2001 ¤Ç¤Ï°ì¤Ä¤ÎÊÑ´¹»ØÄ꤬Äɲäǵ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
141 .TP
142 .B %Z
143 .\"O Timezone name.
144 .\"O This is not implemented in glibc.
145 ¥¿¥¤¥à¥¾¡¼¥ó¤Î̾Á°¡£
146 glibc ¤Ç¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
147 .LP
148 .\"O When
149 .\"O .B %Z
150 .\"O is given, the structure containing the broken-down time
151 .\"O is initialized with values corresponding to the current
152 .\"O time in the given timezone.
153 .\"O Otherwise, the structure is initialized to the broken-down time
154 .\"O corresponding to the current local time (as by a call to
155 .\"O .BR localtime (3)).
156 .B %Z
157 ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢Í×ÁÇÊ̤λþ¹ï¤ò³ÊǼ¤¹¤ë¹½Â¤ÂΤϡ¢
158 »ØÄꤵ¤ì¤¿¥¿¥¤¥à¥¾¡¼¥ó¤Ë¤ª¤±¤ë¸½ºß»þ¹ï¤ËÂбþ¤¹¤ëÃͤǽé´ü²½¤µ¤ì¤ë¡£
159 »ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤³¤Î¹½Â¤ÂΤϸ½ºß¤Î¥í¡¼¥«¥ë¥¿¥¤¥à¤ËÂбþ¤¹¤ë
160 Í×ÁÇÊ̤λþ¹ï¤Ç½é´ü²½¤µ¤ì¤ë
161 .RB ( localtime (3)
162 ¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¤ÈƱ¤¸)¡£
163 .LP
164 .\"O When only the weekday is given, the day is taken to be the first such day
165 .\"O on or after today.
166 ÍËÆü¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
167 º£Æü¤Þ¤¿¤Ïº£Æü°Ê¹ß¤Ç¡¢
168 ¤½¤ÎÍËÆü¤Ë¹çÃפ¹¤ëºÇ½é¤ÎÆü¤¬ºÎÍѤµ¤ì¤ë¡£
169 .LP
170 .\"O When only the month is given (and no year), the month is taken to
171 .\"O be the first such month equal to or after the current month.
172 .\"O If no day is given, it is the first day of the month.
173 (ǯ¤Ê¤·¤Ç) ·î¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
174 º£·î¤Þ¤¿¤Ïº£·î°Ê¹ß¤Ç¡¢
175 ¤½¤Î·î¤Ë¹çÃפ¹¤ëºÇ½é¤Î·î¤¬ºÎÍѤµ¤ì¤ë¡£
176 .LP
177 .\"O When no hour, minute and second are given, the current
178 .\"O hour, minute and second are taken.
179 »þ¡¦Ê¬¡¦É䬤¤¤º¤ì¤â»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
180 ¸½ºß¤Î»þ¡¦Ê¬¡¦É䬺ÎÍѤµ¤ì¤ë¡£
181 .LP
182 .\"O If no date is given, but we know the hour, then that hour is taken
183 .\"O to be the first such hour equal to or after the current hour.
184 ÆüÉդλØÄ꤬¤Ê¤«¤Ã¤¿¤¬¡¢»þ´Ö (hour) ¤À¤±»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢
185 ¸½ºß¤Î»þ´Ö¤Þ¤¿¤Ï¤½¤ì°Ê¹ß¤Ç¡¢¤½¤Î»ØÄê¤Ë¹çÃפ¹¤ëºÇ½é¤Î»þ´Ö¤¬ºÎÍѤµ¤ì¤ë¡£
186
187 .\"O .BR getdate_r ()
188 .\"O is a GNU extension that provides a reentrant version of
189 .\"O .BR getdate ().
190 .\"O Rather than using a global variable to report errors and a static buffer
191 .\"O to return the broken down time,
192 .\"O it returns errors via the function result value,
193 .\"O and returns the resulting broken-down time in the
194 .\"O caller-allocated buffer pointed to by the argument
195 .\"O .IR res .
196 .BR getdate_r ()
197 ¤Ï GNU ³ÈÄ¥¤Ç
198 .BR getdate ()
199 ¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤòÄ󶡤·¤Æ¤¤¤ë¡£
200 .BR getdate_r ()
201 ¤Ç¤Ï¡¢¥¨¥é¡¼¤òÊó¹ð¤¹¤ë¤Î¤Ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»ÈÍѤ·¤¿¤ê¡¢
202 Í×ÁÇÊ̤λþ¹ï¤òÊÖ¤¹¤Î¤ËÀÅŪ¤Ê¥Ð¥Ã¥Õ¥¡¤ò»ÈÍѤ·¤¿¤ê¤»¤º¡¢
203 ¥¨¥é¡¼¤ò´Ø¿ô¤ÎÊÖ¤êÃÍ·Ðͳ¤ÇÊó¹ð¤·¡¢Í×ÁÇÊ̤λþ¹ï¤ò
204 °ú¤­¿ô
205 .I res
206 ¤¬»Ø¤·¼¨¤¹¸Æ¤Ó½Ð¤·Â¦¤Ç³ä¤êÅö¤Æ¤¿¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤·¤ÆÊÖ¤¹¡£
207 .\"O .SH "RETURN VALUE"
208 .SH ÊÖ¤êÃÍ
209 .\"O When successful,
210 .\"O .BR getdate ()
211 .\"O returns a pointer to a
212 .\"O .IR "struct tm" .
213 .\"O Otherwise, it returns NULL and sets the global variable
214 .\"O .IR getdate_err
215 .\"O to one of the error numbers shown below.
216 .\"O Changes to
217 .\"O .I errno
218 .\"O are unspecified.
219 À®¸ù¤¹¤ë¤È¡¢
220 .BR getdate ()
221 ¤Ï
222 .I struct tm
223 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
224 ¼ºÇÔ¤¹¤ë¤È NULL ¤òÊÖ¤·¡¢¥°¥í¡¼¥Ð¥ëÊÑ¿ô
225 .I getdate_err
226 ¤Ë°Ê²¼¤Ë¼¨¤¹¥¨¥é¡¼ÈÖ¹æ¤Î¤¤¤º¤ì¤«°ì¤Ä¤òÀßÄꤹ¤ë¡£
227 .I errno
228 ¤ÎÊѹ¹¤Ë¤Ä¤¤¤Æ¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
229
230 .\"O On success
231 .\"O .BR getdate_r ()
232 .\"O returns 0;
233 .\"O on error it returns one of the error numbers shown below.
234 À®¸ù¤¹¤ë¤È¡¢
235 .BR getdate_r ()
236 ¤Ï 0 ¤òÊÖ¤¹¡£
237 ¼ºÇÔ¤¹¤ë¤È¡¢°Ê²¼¤Ë¼¨¤¹¥¨¥é¡¼ÈÖ¹æ¤Î¤¤¤º¤ì¤«°ì¤Ä¤òÊÖ¤¹¡£
238 .\"O .SH ERRORS
239 .SH ¥¨¥é¡¼
240 .\"O The following errors are returned via
241 .\"O .IR getdate_err
242 .\"O (for
243 .\"O .BR getdate ())
244 .\"O or as the function result (for
245 .\"O .BR getdate_r ()):
246 °Ê²¼¤Î¥¨¥é¡¼¤¬¡¢
247 .RB ( getdate ()
248 ¤Ç¤Ï)
249 .I getdate_err
250 ·Ðͳ¤ÇÊÖ¤µ¤ì¡¢
251 .RB ( getdate_r ()
252 ¤Ç¤Ï) ´Ø¿ô¤ÎÊÖ¤êÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë¡£
253 .TP 4n
254 .B 1
255 .\"O The
256 .\"O .B DATEMSK
257 .\"O environment variable is not defined, or its value is an empty string.
258 ´Ä¶­ÊÑ¿ô
259 .B DATEMASK
260 ¤¬Ì¤ÄêµÁ¡¢¤Þ¤¿¤Ï¤½¤ÎÃͤ¬¶õʸ»úÎó¤Ç¤¢¤ë¡£
261 .TP
262 .B 2
263 .\"O The template file specified by
264 .\"O .B DATEMSK
265 .\"O cannot be opened for reading.
266 .B DATEMSK
267 ¤Ç»ØÄꤵ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ßÍѤ˥ª¡¼¥×¥ó¤Ç¤­¤Ê¤¤¡£
268 .TP
269 .B 3
270 .\"O Failed to get file status information.
271 ¥Õ¥¡¥¤¥ë¤Î¥¹¥Æ¡¼¥¿¥¹¾ðÊ󤬼èÆÀ¤Ç¤­¤Ê¤¤¡£
272 .\" stat()
273 .TP
274 .B 4
275 .\"O The template file is not a regular file.
276 ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤Ê¤¤¡£
277 .TP
278 .B 5
279 .\"O An error was encountered while reading the template file.
280 ¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ßÃæ¤Ë¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£
281 .TP
282 .B 6
283 .\"O Memory allocation failed (not enough memory available).
284 .\"O .\" Error 6 doesn't seem to occur in glibc
285 ¥á¥â¥ê¤Î³ä¤êÅö¤Æ¤Ë¼ºÇÔ¤·¤¿ (¥á¥â¥ê¤¬Â­¤ê¤Ê¤¤)¡£
286 .\" ¥¨¥é¡¼ 6 ¤Ï glibc ¤Ç¤ÏȯÀ¸¤·¤Ê¤¤¤è¤¦¤Ë¸«¤¨¤ë¡£
287 .TP
288 .B 7
289 .\"O There is no line in the file that matches the input.
290 ÆþÎϤ˥ޥåÁ¤·¤¿¥Õ¥¡¥¤¥ë¤Ë¡¢¹Ô¤¬´Þ¤Þ¤ì¤Æ¤¤¤Ê¤¤¡£
291 .TP
292 .B 8
293 .\"O Invalid input specification.
294 ÆþÎÏ»ØÄ꤬Àµ¤·¤¯¤Ê¤¤¡£
295 .\"O .SH ENVIRONMENT
296 .SH ´Ä¶­ÊÑ¿ô
297 .TP
298 .B DATEMSK
299 .\"O File containing format patterns.
300 ½ñ¼°¥Ñ¥¿¡¼¥ó¤ò´Þ¤à¥Õ¥¡¥¤¥ë¡£
301 .TP
302 .BR TZ ", " LC_TIME
303 .\"O Variables used by
304 .\"O .BR strptime (3).
305 .BR strptime (3)
306 ¤¬ÍѤ¤¤ëÊÑ¿ô¡£
307 .\"O .SH "CONFORMING TO"
308 .SH ½àµò
309 POSIX.1-2001.
310 .\"O .SH NOTES
311 .SH Ãí°Õ
312 .\"O The POSIX.1-2001 specification for
313 .\"O .BR strptime (3)
314 .\"O contains conversion specifications using the
315 .\"O .B %E
316 .\"O or
317 .\"O .B %O
318 .\"O modifier, while such specifications are not given for
319 .\"O .BR getdate ().
320 .\"O In glibc,
321 .\"O .BR getdate ()
322 .\"O is implemented using
323 .\"O .BR strptime (3),
324 .\"O so that precisely the same conversions are supported by both.
325 POSIX.1-2001 »ÅÍͤǤϡ¢
326 .BR strptime (3)
327 ¤Ë¤Ä¤¤¤Æ¤Ï
328 .B %E
329 ¤ä
330 .B %O
331 ¤È¤¤¤Ã¤¿½¤Àµ»Ò¤òÍѤ¤¤¿ÊÑ´¹»ØÄê¤òµ¬Äꤷ¤Æ¤¤¤ë¤¬¡¢
332 .BR getdate ()
333 ¤Ë¤Ä¤¤¤Æ¤Ï¤³¤Î¤è¤¦¤Ê½¤¾þ»Ò¤Îµ¬Äê¤Ï¤Ê¤¤¡£
334 glibc ¤Ç¤Ï¡¢
335 .BR getdate ()
336 ¤Ï
337 .BR strptime (3)
338 ¤òÍѤ¤¤Æ¼ÂÁõ¤µ¤ì¤Æ¤ª¤ê¡¢
339 ξ¼Ô¤Ç¤ÏÁ´¤¯Æ±¤¸ÊÑ´¹¤¬Î¾¼Ô¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
340 .\"O .SH EXAMPLE
341 .SH Îã
342 .\"O The program below calls
343 .\"O .BR getdate ()
344 .\"O for each of its command-line arguments,
345 .\"O and for each call displays the values in the fields of the returned
346 .\"O .I tm
347 .\"O structure.
348 .\"O The following shell session demonstrates the operation of the program:
349 °Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤Î¤½¤ì¤¾¤ì¤Ë¤Ä¤¤¤Æ
350 .BR getdate ()
351 ¤ò¸Æ¤Ó½Ð¤·¡¢¤½¤ì¤¾¤ì¤Ë¤Ä¤¤¤ÆÊÖ¤µ¤ì¤¿
352 .I tm
353 ¹½Â¤ÂΤΥե£¡¼¥ë¥ÉÃͤòɽ¼¨¤¹¤ë¡£
354 ¼¡¤Î¥·¥§¥ë¡¦¥»¥Ã¥·¥ç¥ó¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÆ°ºîÎã¤Ç¤¢¤ë¡£
355
356 .in +4n
357 .nf
358 .RB "$" " TFILE=$PWD/tfile"
359 .RB "$" " echo \(aq%A\(aq > $TFILE " "      # Full weekday name"
360 .RB "$" " echo \(aq%T\(aq >> $TFILE" "      # ISO date (YYYY-MM-DD)"
361 .RB "$" " echo \(aq%F\(aq >> $TFILE" "      # Time (HH:MM:SS)"
362 .RB "$" " date"
363 .RB "$" " export DATEMSK=$TFILE"
364 .RB "$" " ./a.out Tuesday \(aq2009-12-28\(aq \(aq12:22:33\(aq"
365 Sun Sep  7 06:03:36 CEST 2008
366 Call 1 ("Tuesday") succeeded:
367     tm_sec   = 36
368     tm_min   = 3
369     tm_hour  = 6
370     tm_mday  = 9
371     tm_mon   = 8
372     tm_year  = 108
373     tm_wday  = 2
374     tm_yday  = 252
375     tm_isdst = 1
376 Call 2 ("2009-12-28") succeeded:
377     tm_sec   = 36
378     tm_min   = 3
379     tm_hour  = 6
380     tm_mday  = 28
381     tm_mon   = 11
382     tm_year  = 109
383     tm_wday  = 1
384     tm_yday  = 361
385     tm_isdst = 0
386 Call 3 ("12:22:33") succeeded:
387     tm_sec   = 33
388     tm_min   = 22
389     tm_hour  = 12
390     tm_mday  = 7
391     tm_mon   = 8
392     tm_year  = 108
393     tm_wday  = 0
394     tm_yday  = 250
395     tm_isdst = 1
396 .fi
397 .in
398 .\"O .SS Program source
399 .SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹
400 \&
401 .nf
402 #define _GNU_SOURCE 500
403 #include <time.h>
404 #include <stdio.h>
405 #include <stdlib.h>
406
407 int
408 main(int argc, char *argv[])
409 {
410     struct tm *tmp;
411     int j;
412
413     for (j = 1; j < argc; j++) {
414         tmp = getdate(argv[j]);
415
416         if (tmp == NULL) {
417             printf("Call %d failed; getdate_err = %d\\n",
418                    j, getdate_err);
419             continue;
420         }
421
422         printf("Call %d (\\"%s\\") succeeded:\\n", j, argv[j]);
423         printf("    tm_sec   = %d\\n", tmp\->tm_sec);
424         printf("    tm_min   = %d\\n", tmp\->tm_min);
425         printf("    tm_hour  = %d\\n", tmp\->tm_hour);
426         printf("    tm_mday  = %d\\n", tmp\->tm_mday);
427         printf("    tm_mon   = %d\\n", tmp\->tm_mon);
428         printf("    tm_year  = %d\\n", tmp\->tm_year);
429         printf("    tm_wday  = %d\\n", tmp\->tm_wday);
430         printf("    tm_yday  = %d\\n", tmp\->tm_yday);
431         printf("    tm_isdst = %d\\n", tmp\->tm_isdst);
432     }
433
434     exit(EXIT_SUCCESS);
435 }
436 .fi
437 .\"O .SH "SEE ALSO"
438 .SH ´ØÏ¢¹àÌÜ
439 .BR time (2),
440 .BR localtime (3),
441 .BR setlocale (3),
442 .BR strftime (3),
443 .BR strptime (3)