OSDN Git Service

(split) LDP v3.30, v3.31 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / ctime.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Sat Jul 24 19:49:27 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Fri Apr 26 12:38:55 MET DST 1996 by Martin Schulze (joey@linux.de)
29 .\" Modified 2001-11-13, aeb
30 .\" Modified 2004-11-16, mtk
31 .\"
32 .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
33 .\"         all rights reserved.
34 .\" Translated 1997-02-10, Hiroaki Nagoya <nagoya@is.titech.ac.jp>
35 .\" Updated 1999-09-01, Kentaro Shirakata <argrath@ub32.org>
36 .\" Updated 2001-10-15, Kentaro Shirakata <argrath@ub32.org>
37 .\" Updated 2001-12-13, Kentaro Shirakata <argrath@ub32.org>
38 .\" Updated 2002-01-03, Kentaro Shirakata <argrath@ub32.org>
39 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated 2008-04-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.79
41 .\" Updated 2008-08-08, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
42 .\" Updated 2008-11-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
43 .\"
44 .\"WORD: Coordinated Univarsal Time  ¶¨ÄêÀ¤³¦»þ
45 .\"WORD: broken-down time  Í×ÁÇÊ̤λþ¹ï
46 .\"
47 .TH CTIME 3 2010-02-25 "" "Linux Programmer's Manual"
48 .\"O .SH NAME
49 .SH Ì¾Á°
50 .\"O asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r,
51 .\"O localtime_r \- transform date and time to broken-down time or ASCII
52 asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r,
53 localtime_r \- ÆüÉդȻþ¹ï¤òÍ×ÁÇÊ̤λþ¹ï¤ä ASCII ¤ËÊÑ´¹¤¹¤ë
54 .\"O .SH SYNOPSIS
55 .SH ½ñ¼°
56 .nf
57 .B #include <time.h>
58 .sp
59 .BI "char *asctime(const struct tm *" tm );
60 .br
61 .BI "char *asctime_r(const struct tm *" tm ", char *" buf );
62 .sp
63 .BI "char *ctime(const time_t *" timep );
64 .br
65 .BI "char *ctime_r(const time_t *" timep ", char *" buf );
66 .sp
67 .BI "struct tm *gmtime(const time_t *" timep );
68 .br
69 .BI "struct tm *gmtime_r(const time_t *" timep ", struct tm *" result );
70 .sp
71 .BI "struct tm *localtime(const time_t *" timep );
72 .br
73 .BI "struct tm *localtime_r(const time_t *" timep ", struct tm *" result );
74 .sp
75 .BI "time_t mktime(struct tm *" tm );
76 .fi
77 .sp
78 .in -4n
79 .\"O Feature Test Macro Requirements for glibc (see
80 .\"O .BR feature_test_macros (7)):
81 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
82 .RB ( feature_test_macros (7)
83 »²¾È):
84 .in
85 .ad l
86 .sp
87 .BR asctime_r (),
88 .BR ctime_r (),
89 .BR gmtime_r (),
90 .BR localtime_r ():
91 .RS
92 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE ||
93 _SVID_SOURCE || _POSIX_SOURCE
94 .RE
95 .ad
96 .\"O .SH DESCRIPTION
97 .SH ÀâÌÀ
98 .\"O The
99 .\"O .BR ctime (),
100 .\"O .BR gmtime ()
101 .\"O and
102 .\"O .BR localtime ()
103 .\"O functions all take
104 .\"O an argument of data type \fItime_t\fP which represents calendar time.
105 .\"O When interpreted as an absolute time value, it represents the number of
106 .\"O seconds elapsed since the Epoch, 1970-01-01 00:00:00 +0000 (UTC).
107 ´Ø¿ô
108 .BR ctime (),
109 .BR gmtime (),
110 .BR localtime ()
111 ¤Ï
112 \fItime_t\fP ·¿¤Î¥«¥ì¥ó¥À¡¼»þ¹ï¤ò°ú¤­¿ô¤Ë¤È¤ë¡£
113 °ú¤­¿ô¤¬ÀäÂÐÃͤȤ·¤Æ²ò¼á¤µ¤ì¤ë¾ì¹ç¤Ï¡¢»þ¹ïµª¸µ (Epoch;
114 1970-01-01 00:00:00 +0000 (UTC)) ¤«¤é¤Î·Ð²áÉÿô¤È²ò¼á¤µ¤ì¤ë¡£
115 .PP
116 .\"O The
117 .\"O .BR asctime ()
118 .\"O and
119 .\"O .BR mktime ()
120 .\"O functions both take an argument
121 .\"O representing broken-down time which is a representation
122 .\"O separated into year, month, day, etc.
123 ´Ø¿ô
124 .BR asctime ()
125 ¤È
126 .BR mktime ()
127 ¤Ï
128 ǯ¡¦·î¡¦Æü¤Ê¤É¤ËʬΥ¤µ¤ì¤¿Í×ÁÇÊ̤λþ¹ï¤ò°ú¤­¿ô¤È¤¹¤ë¡£
129 .PP
130 .\"O Broken-down time is stored
131 .\"O in the structure \fItm\fP which is defined in \fI<time.h>\fP as follows:
132 Í×ÁÇÊ̤λþ¹ï¤Ï \fI<time.h>\fP ¤Ç°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë
133 \fItm\fP ¹½Â¤ÂΤËÊÝ»ý¤µ¤ì¤ë¡£
134 .sp
135 .in +4n
136 .nf
137 struct tm {
138 .\"O     int tm_sec;         /* seconds */
139 .\"O     int tm_min;         /* minutes */
140 .\"O     int tm_hour;        /* hours */
141 .\"O     int tm_mday;        /* day of the month */
142 .\"O     int tm_mon;         /* month */
143 .\"O     int tm_year;        /* year */
144 .\"O     int tm_wday;        /* day of the week */
145 .\"O     int tm_yday;        /* day in the year */
146 .\"O     int tm_isdst;       /* daylight saving time */
147     int tm_sec;         /* Éà*/
148     int tm_min;         /* ʬ */
149     int tm_hour;        /* »þ´Ö */
150     int tm_mday;        /* Æü */
151     int tm_mon;         /* ·î */
152     int tm_year;        /* ǯ */
153     int tm_wday;        /* ÍËÆü */
154     int tm_yday;        /* Ç¯ÆâÄÌ»»Æü */
155     int tm_isdst;       /* ²Æ»þ´Ö */
156 };
157 .fi
158 .in
159 .PP
160 .\"O The members of the \fItm\fP structure are:
161 \fItm\fP ¹½Â¤ÂΤΥá¥ó¥Ð¡¼¤Ï°Ê²¼¤ÎÄ̤ê:
162 .TP 10
163 .I tm_sec
164 .\"O The number of seconds after the minute, normally in the range 0 to 59,
165 .\"O but can be up to 60 to allow for leap seconds.
166 Éÿô¡¢¤Õ¤Ä¤¦¤Ï 0 ¤«¤é 59 ¤Þ¤Ç¤ÎÃÍ¡¢
167 ¤·¤«¤·±¼ÉäΤ¿¤á 60 ¤Þ¤Ç¤ÎÃͤϵö¤µ¤ì¤ë¡£
168 .TP
169 .I tm_min
170 .\"O The number of minutes after the hour, in the range 0 to 59.
171 ʬ¿ô¡¢0 ¤«¤é 59 ¤Þ¤Ç¤ÎÃÍ¡£
172 .TP
173 .I tm_hour
174 .\"O The number of hours past midnight, in the range 0 to 23.
175 ¿¿ÌëÃ椫¤é¤ÎÄÌ»»»þ´Ö¡¢0 ¤«¤é 23 ¤Þ¤Ç¤ÎÃÍ¡£
176 .TP
177 .I tm_mday
178 .\"O The day of the month, in the range 1 to 31.
179 ·î¤Ï¤¸¤á¤«¤é¤ÎÆü¿ô¡¢1 ¤«¤é 31 ¤Þ¤Ç¤ÎÃÍ¡£
180 .TP
181 .I tm_mon
182 .\"O The number of months since January, in the range 0 to 11.
183 1·î¤«¤é¤ÎÄÌ»»·î¿ô¡¢0 ¤«¤é 11 ¤Þ¤Ç¤ÎÃÍ¡£
184 .TP
185 .I tm_year
186 .\"O The number of years since 1900.
187 1900 Ç¯¤«¤é¤ÎÄÌ»»Ç¯¿ô¡£
188 .TP
189 .I tm_wday
190 .\"O The number of days since Sunday, in the range 0 to 6.
191 ÆüÍËÆü¤«¤é¤ÎÄÌ»»Æü¿ô(ÍËÆü)¡£0 ¤«¤é 6 ¤Þ¤Ç¤ÎÃÍ¡£
192 .TP
193 .I tm_yday
194 .\"O The number of days since January 1, in the range 0 to 365.
195 1 ·î 1 Æü¤«¤é¤ÎÄÌ»»Æü¿ô¡¢0 ¤«¤é 365 ¤Þ¤Ç¤ÎÃÍ¡£
196 .TP
197 .I tm_isdst
198 .\"O A flag that indicates whether daylight saving time is in effect at the
199 .\"O time described.
200 .\"O The value is positive if daylight saving time is in
201 .\"O effect, zero if it is not, and negative if the information is not
202 .\"O available.
203 ²Æ»þ´Ö¤¬Í­¸ú¤«¤É¤¦¤«¤Î¥Õ¥é¥°¡£
204 Àµ¤ÎÃͤʤé¤Ð²Æ»þ´Ö¤ÏÍ­¸ú¤Ë¤Ê¤ê¡¢0 ¤Ê¤é¤Ð̵¸ú¡¢Éé¤ÎÃͤʤé¤Ð¤³¤Î¾ðÊó¤Ë¤Ï
205 °ÕÌ£¤¬¤Ê¤¤¡£
206 .PP
207 .\"O The call
208 .\"O .BI ctime( t )
209 .\"O is equivalent to
210 .\"O .BI asctime(localtime( t )) \fR.
211 .\"O It converts the calendar time \fIt\fP into a
212 .\"O null-terminated string of the form
213 .\"O .sp
214 .\"O .RS
215 .\"O "Wed Jun 30 21:49:08 1993\\n"
216 .\"O .RE
217 .\"O .sp
218 .BI ctime( t )
219 ´Ø¿ô¤Ï¡¢
220 .BI asctime(localtime( t ))
221 ¤ÈÅù²Á¤Ç¤¢¤ë¡£
222 ¥«¥ì¥ó¥À¡¼»þ¹ï \fIt\fP ¤ò
223 .sp
224 .RS
225 "Wed Jun 30 21:49:08 1993\\n"
226 .RE
227 .sp
228 ¤È¤¤¤¦·Á¼°¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤ØÊÑ´¹¤¹¤ë¡£
229 .\"O The abbreviations for the days of the week are "Sun", "Mon", "Tue", "Wed",
230 .\"O "Thu", "Fri", and "Sat".
231 .\"O The abbreviations for the months are "Jan",
232 .\"O "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", and
233 .\"O "Dec".
234 .\"O The return value points to a statically allocated string which
235 .\"O might be overwritten by subsequent calls to any of the date and time
236 .\"O functions.
237 .\"O The function also sets the external
238 .\"O variables \fItzname\fP, \fItimezone\fP, and \fIdaylight\fP (see
239 .\"O .BR tzset (3))
240 .\"O with information about the current timezone.
241 ÍËÆü¤Îά¾Î¤Ï
242 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ¤Ç¤¢¤ë¡£
243 ·î¤Îά¾Î¤Ï "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
244 "Sep", "Oct", "Nov", "Dec" ¤Ç¤¢¤ë¡£
245 ÊÖ¤êÃͤϡ¢ÀÅŪ (static) ¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
246 ¤³¤Îʸ»úÎó¤Ï¡¢ÆüÉÕ¡¦»þ¹ï´Ø¿ô¤Î¤¤¤º¤ì¤«¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È¾å½ñ¤­¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
247 ¤Þ¤¿¤³¤Î´Ø¿ô¤ÏÂç°èÊÑ¿ô \fItzname\fP, \fItimezone\fP, \fIdaylight\fP
248 ¤Ë¸½ºß¤Î¥¿¥¤¥à¥¾¡¼¥ó¤Î¾ðÊó¤òÀßÄꤹ¤ë
249 .RB ( tzset (3)
250 »²¾È)¡£
251 .\"O The reentrant version
252 .\"O .BR ctime_r ()
253 .\"O does the same, but stores the
254 .\"O string in a user-supplied buffer
255 .\"O which should have room for at least 26 bytes.
256 .\"O It need not
257 .\"O set \fItzname\fP, \fItimezone\fP, and \fIdaylight\fP.
258 ¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë
259 .BR ctime_r ()
260 ¤âƱÍͤÀ¤¬¡¢
261 ʸ»úÎó¤Ï¥æ¡¼¥¶¡¼¤¬ÍÑ°Õ¤·¤¿¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤ë¡£¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤Ï
262 ¾¯¤Ê¤¯¤È¤â 26 ¥Ð¥¤¥È°Ê¾å¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
263 ¤³¤Î´Ø¿ô¤Ï \fItzname\fP, \fItimezone\fP, and \fIdaylight\fP
264 ¤òÀßÄꤹ¤ëɬÍפϤʤ¤¡£
265 .PP
266 .\"O The
267 .\"O .BR gmtime ()
268 .\"O function converts the calendar time \fItimep\fP to
269 .\"O broken-down time representation, expressed in Coordinated Universal Time
270 .\"O (UTC).
271 .\"O It may return NULL when the year does not fit into an integer.
272 ´Ø¿ô
273 .BR gmtime ()
274 ¤Ï¡¢¥«¥ì¥ó¥À¡¼»þ¹ï \fItimep\fP ¤ò
275 ¶¨ÄêÀ¤³¦»þ (UTC) ¤Ç¤ÎÍ×ÁÇÊ̤λþ¹ï¤ØÊÑ´¹¤¹¤ë¡£
276 ǯ¤¬À°¿ô·¿¤Ë¼ý¤Þ¤é¤Ê¤¤¾ì¹ç¡¢NULL ¤òÊÖ¤¹¡£
277 .\"O The return value points to a statically allocated struct which might be
278 .\"O overwritten by subsequent calls to any of the date and time functions.
279 ÊÖ¤êÃͤÏÀÅŪ¤Ë³ÎÊݤµ¤ì¤¿¹½Â¤ÂΤò»Ø¤·¤Æ¤ª¤ê¡¢¤³¤Î¸å¤Ç
280 ÆüÉÕ¤ä»þ¹ï¤Ë´Ø¤¹¤ë´Ø¿ô¤Î¤¤¤º¤ì¤«¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È
281 ¾å½ñ¤­¤µ¤ì¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
282 .\"O The
283 .\"O .BR gmtime_r ()
284 .\"O function does the same, but stores the data in a
285 .\"O user-supplied struct.
286 .BR gmtime_r ()
287 ¤âƱÍͤÀ¤¬¡¢
288 ¥Ç¡¼¥¿¤Ï¥æ¡¼¥¶¡¼¤¬ÍÑ°Õ¤·¤¿¹½Â¤ÂΤ˳ÊǼ¤µ¤ì¤ë¡£
289 .PP
290 .\"O The
291 .\"O .BR localtime ()
292 .\"O function converts the calendar time \fItimep\fP to
293 .\"O broken-down time representation,
294 .\"O expressed relative to the user's specified timezone.
295 .\"O The function acts as if it called
296 .\"O .BR tzset (3)
297 .\"O and sets the external variables \fItzname\fP with
298 .\"O information about the current timezone, \fItimezone\fP with the difference
299 .\"O between Coordinated Universal Time (UTC) and local standard time in
300 .\"O seconds, and \fIdaylight\fP to a nonzero value if daylight savings
301 .\"O time rules apply during some part of the year.
302 ´Ø¿ô
303 .BR localtime ()
304 ¤Ï¡¢¥«¥ì¥ó¥À¡¼»þ¹ï \fItimep\fP ¤ò
305 ¥æ¡¼¥¶¤¬»ØÄꤷ¤¿¥¿¥¤¥à¥¾¡¼¥ó¤Ç¤Î»þ¹ïÍ×ÁÇÊ̤Îɽ¸½¤ØÊÑ´¹¤¹¤ë¡£
306 ¤³¤Î´Ø¿ô¤Ï
307 .BR tzset (3)
308 ¤ò¸Æ¤Ó½Ð¤·¤¿¤«¤Î¤è¤¦¤Ë¿¶Éñ¤¤¡¢
309 Âç°èÊÑ¿ô \fItzname\fP ¤Ë¸½ºß¤Î¥¿¥¤¥à¥¾¡¼¥ó¤Î¾ðÊó¤òÀßÄꤹ¤ë¡£
310 ¤Þ¤¿¡¢\fItimezone\fP ¤Ë¶¨ÄêÀ¤³¦»þ (UTC) ¤È¥í¡¼¥«¥ëɸ½à»þ¤È¤Î
311 »þº¹¤ÎÉÿô¤òÀßÄꤷ¡¢
312 °ìǯ¤Î°ìÉô¤Ç²Æ»þ´Ö¤¬Å¬ÍѤµ¤ì¤ë¾ì¹ç¤Ï \fIdaylight\fP ¤Ë 0 ¤¬ÀßÄꤵ¤ì¤ë¡£
313 .\"O The return value points to a statically allocated struct which might be
314 .\"O overwritten by subsequent calls to any of the date and time functions.
315 ÊÖ¤êÃͤÏÀÅŪ¤Ë³ÎÊݤµ¤ì¤¿¹½Â¤ÂΤò»Ø¤·¤Æ¤ª¤ê¡¢¤³¤Î¸å¤Ç
316 ÆüÉÕ¤ä»þ¹ï¤Ë´Ø¤¹¤ë´Ø¿ô¤Î¤¤¤º¤ì¤«¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È
317 ¾å½ñ¤­¤µ¤ì¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
318 .\"O The
319 .\"O .BR localtime_r ()
320 .\"O function does the same, but stores the data in a
321 .\"O user-supplied struct.
322 .\"O It need not set \fItzname\fP, \fItimezone\fP, and \fIdaylight\fP.
323 .BR localtime_r ()
324 ¤âƱÍͤÀ¤¬¡¢
325 ¥Ç¡¼¥¿¤Ï¥æ¡¼¥¶¡¼¤¬ÍÑ°Õ¤·¤¿¹½Â¤ÂΤ˳ÊǼ¤µ¤ì¤ë¡£
326 ¤³¤Î´Ø¿ô¤Ï \fItzname\fP, \fItimezone\fP, and \fIdaylight\fP
327 ¤òÀßÄꤹ¤ëɬÍפϤʤ¤¡£
328 .PP
329 .\"O The
330 .\"O .BR asctime ()
331 .\"O function converts the broken-down time value
332 .\"O \fItm\fP into a null-terminated string with the same format as
333 .\"O .BR ctime ().
334 .\"O The return value points to a statically allocated string which might be
335 .\"O overwritten by subsequent calls to any of the date and time functions.
336 ´Ø¿ô
337 .BR asctime ()
338 ¤Ï¡¢Í×ÁÇÊ̤λþ¹ï \fItm\fP ¤ò
339 .BR ctime ()
340 ¤ÈƱ¤¸·Á¼°¤Î NULL ½ªÃ¼¤µ¤ì¤¿Ê¸»úÎó¤ØÊÑ´¹¤¹¤ë¡£
341 ÊÖ¤êÃͤÏÀÅŪ¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿Ê¸»úÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Îʸ»úÎó¤Ï¡¢
342 ÆüÉÕ¡¦»þ¹ï´Ø¿ô¤Î¤¤¤º¤ì¤«¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È¾å½ñ¤­¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
343 .\"O The
344 .\"O .BR asctime_r ()
345 .\"O function does the same, but stores the string in
346 .\"O a user-supplied buffer which should have room for at least 26 bytes.
347 ¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤǤ¢¤ë
348 .BR asctime_r ()
349 ¤âƱÍͤÀ¤¬¡¢
350 ʸ»úÎó¤Ï¥æ¡¼¥¶¡¼¤¬ÍÑ°Õ¤·¤¿¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤ë¡£¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤Ï
351 ¾¯¤Ê¤¯¤È¤â 26 ¥Ð¥¤¥È°Ê¾å¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
352 .PP
353 .\"O The
354 .\"O .BR mktime ()
355 .\"O function converts a broken-down time structure, expressed
356 .\"O as local time, to calendar time representation.
357 .\"O The function ignores
358 .\"O the values supplied by the caller in the
359 .\"O .I tm_wday
360 .\"O and
361 .\"O .I tm_yday
362 .\"O fields.
363 .\"O The value specified in the
364 .\"O .I tm_isdst
365 .\"O field informs
366 .\"O .BR mktime ()
367 .\"O whether or not daylight saving time (DST)
368 .\"O is in effect for the time supplied in the
369 .\"O .I tm
370 .\"O structure:
371 .\"O a positive value means DST is in effect;
372 .\"O zero means that DST is not in effect;
373 .\"O and a negative value means that
374 .\"O .BR mktime ()
375 .\"O should (use timezone information and system databases to)
376 .\"O attempt to determine whether DST is in effect at the specified time.
377 ´Ø¿ô
378 .BR mktime ()
379 ¤Ï¡¢(¥í¡¼¥«¥ë¥¿¥¤¥à¤Çµ­½Ò¤µ¤ì¤Æ¤¤¤ë) Í×ÁÇÊ̤λþ¹ï¤ò
380 ¥«¥ì¥ó¥À¡¼»þ¹ï¤ØÊÑ´¹¤¹¤ë¡£¤³¤ÎºÝ¡¢¸Æ¤Ó½Ð¤·¸µ¤¬¥Õ¥£¡¼¥ë¥É
381 .I tm_wday
382 ¤È
383 .I tm_yday
384 ¤Ç»ØÄꤷ¤¿ÃͤÏ̵»ë¤µ¤ì¤ë¡£
385 .BR mktime ()
386 ¤Ï¡¢¥Õ¥£¡¼¥ë¥É
387 .I tm_isdst
388 ¤Ç»ØÄꤵ¤ì¤¿Ãͤˤè¤ê¡¢
389 .I tm
390 ¹½Â¤ÂΤÇÅϤµ¤ì¤¿»þ¹ï¤Ç²Æ»þ´Ö (daylight saving time; DST) ¤¬Í­¸ú¤Ë¤Ê¤Ã¤Æ
391 ¤¤¤ë¤«¤òÃΤ롣
392 Àµ¤ÎÃͤϲƻþ´Ö¤¬Í­¸ú¤Ç¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
393 Éé¤ÎÃͤǤ¢¤ì¤Ð¡¢
394 .BR mktime ()
395 ¤Ï (¥¿¥¤¥à¥¾¡¼¥ó¾ðÊó¤È¥·¥¹¥Æ¥à¤Î¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò»È¤Ã¤Æ)
396 »ØÄꤵ¤ì¤¿»þ¹ï¤Ç²Æ»þ´Ö¤¬Í­¸ú¤«¤É¤¦¤«¤òȽÃǤ¹¤ëɬÍפ¬¤¢¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
397
398 .\"O The
399 .\"O .BR mktime ()
400 .\"O function modifies the fields of the
401 .\"O .IR tm
402 .\"O structure as follows:
403 .\"O .I tm_wday
404 .\"O and
405 .\"O .I tm_yday
406 .\"O are set to values determined from the contents of the other fields;
407 .BR mktime ()
408 ¤Ï
409 .I tm
410 ¹½Â¤ÂΤγƥե£¡¼¥ë¥É¤ò°Ê²¼¤Î¤è¤¦¤Ë½¤Àµ¤¹¤ë¡£
411 .I tm_wday
412 ¤È
413 .I tm_yday
414 ¤Ë¤Ï¾¤Î¥Õ¥£¡¼¥ë¥É¤ÎÆâÍƤ«¤éµá¤á¤¿ÃͤòÀßÄꤹ¤ë¡£
415 .\"O if structure members are outside their valid interval, they will be
416 .\"O normalized (so that, for example, 40 October is changed into 9 November);
417 .\"O .I tm_isdst
418 .\"O is set (regardless of its initial value)
419 .\"O to a positive value or to 0, respectively,
420 .\"O to indicate whether DST is or is not in effect at the specified time.
421 ¹½Â¤ÂΤÎÍ×ÁǤ¬Í­¸ú¤ÊÈϰϤˤʤ¤¾ì¹ç¡¢Àµµ¬²½¤µ¤ì¤ë
422 (Î㤨¤Ð¡¢10 ·î 40 Æü¤Ï 11 ·î 9 Æü¤ËÊѹ¹¤µ¤ì¤ë)¡£
423 .I tm_isdst
424 ¤Ë¤Ï (ºÇ½é¤ÎÃͤˤ«¤«¤ï¤é¤º) Àµ¤ÎÃͤ« 0 ¤¬ÀßÄꤵ¤ì¤ë¡£
425 Àµ¤ÎÃͤϻØÄꤵ¤ì¤¿»þ´Ö¤Ç²Æ»þ´Ö¤¬Í­¸ú¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¡¢
426 0 ¤Ï̵¸ú¤Ç¤¢¤ë¤³¤È¤ò¼¨¤¹¡£
427 .\"O Calling
428 .\"O .BR mktime ()
429 .\"O also sets the external variable \fItzname\fP with
430 .\"O information about the current timezone.
431 ´Ø¿ô
432 .BR mktime ()
433 ¤ò¸Æ¤Ó½Ð¤¹¤È¡¢
434 Âç°èÊÑ¿ô \fItzname\fP ¤¬¸½ºß¤Î¥¿¥¤¥à¥¾¡¼¥ó¤ËÀßÄꤵ¤ì¤ë¡£
435
436 .\"O If the specified broken-down
437 .\"O time cannot be represented as calendar time (seconds since the Epoch),
438 .\"O .BR mktime ()
439 .\"O returns
440 .\"O .I (time_t)\ \-1
441 .\"O and does not alter the
442 .\"O members of the broken-down time structure.
443 Í×ÁÇÊ̤λþ¹ï¤ò¥«¥ì¥ó¥À¡¼»þ¹ï (µª¸µ (Epoch) ¤«¤é¤ÎÉÿô) ¤Çɽ¸½¤Ç¤­¤Ê¤¤¾ì¹ç¡¢
444 .BR mktime ()
445 ¤Ï
446 .I (time_t)\ (-1)
447 ¤òÊÖ¤·¡¢Í×ÁÇÊ̤λþ¹ï¤Î¹½Â¤ÂÎ¥á¥ó¥Ð¡¼¤òÊѹ¹¤·¤Ê¤¤¡£
448 .\"O .SH "RETURN VALUE"
449 .SH ÊÖ¤êÃÍ
450 .\"O Each of these functions returns the value described, or NULL
451 .\"O (\-1 in case of
452 .\"O .BR mktime ())
453 .\"O in case an error was detected.
454 ³Æ´Ø¿ô¤Ï¤½¤ì¤¾¤ìÁ°½Ò¤·¤¿ÃͤòÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï NULL
455 .RB ( mktime ()
456 ¤Ç¤Ï \-1) ¤òÊÖ¤¹¡£
457 .SH ½àµò
458 .\"O POSIX.1-2001.
459 .\"O C89 and C99 specify
460 .\"O .BR asctime (),
461 .\"O .BR ctime (),
462 .\"O .BR gmtime (),
463 .\"O .BR localtime (),
464 .\"O and
465 .\"O .BR mktime ().
466 POSIX.1-2001.
467 C89 ¤È C99 ¤Ç¤Ï
468 .BR asctime (),
469 .BR ctime (),
470 .BR gmtime (),
471 .BR localtime (),
472 .BR mktime ()
473 ¤¬µ¬Äꤵ¤ì¤Æ¤¤¤ë¡£
474 .\"O POSIX.1-2008 marks
475 .\"O .BR asctime (),
476 .\"O .BR asctime_r (),
477 .\"O .BR ctime (),
478 .\"O and
479 .\"O .BR ctime_r ()
480 .\"O as obsolete,
481 .\"O recommending the use of
482 .\"O .BR strftime (3)
483 .\"O instead.
484 POSIX.1-2008 ¤Ï¡¢
485 .BR asctime (),
486 .BR asctime_r (),
487 .BR ctime (),
488 .BR ctime_r ()
489 ¤òÇÑ»ßͽÄê¤È¤·¤Æ¤¤¤ë¡£
490 Âå¤ï¤ê¤Ë¡¢
491 .BR strftime (3)
492 ¤Î»ÈÍѤ¬¿ä¾©¤µ¤ì¤Æ¤¤¤ë¡£
493 .\"O .SH NOTES
494 .SH Ãí°Õ
495 .\"O The four functions
496 .\"O .BR asctime (),
497 .\"O .BR ctime (),
498 .\"O .BR gmtime ()
499 .\"O and
500 .\"O .BR localtime ()
501 .\"O return a pointer to static data and hence are not thread-safe.
502 .BR asctime (),
503 .BR ctime (),
504 .BR gmtime (),
505 .BR localtime ()
506 ¤Î 4 ¤Ä¤Î´Ø¿ô¤ÏÀÅŪ¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¤Î¤Ç¡¢¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤Ï¤Ê¤¤¡£
507 .\"O Thread-safe versions
508 .\"O .BR asctime_r (),
509 .\"O .BR ctime_r (),
510 .\"O .BR gmtime_r ()
511 .\"O and
512 .\"O .BR localtime_r ()
513 .\"O are specified by SUSv2, and available since libc 5.2.5.
514 ¤³¤ì¤é¤Î´Ø¿ô¤Î¥¹¥ì¥Ã¥É¥»¡¼¥ÕÈǤǤ¢¤ë
515 .BR asctime_r (),
516 .BR ctime_r (),
517 .BR gmtime_r (),
518 .BR localtime_r ()
519 ¤Ï SUSv2 ¤Çµ¬Äꤵ¤ì¤Æ¤ª¤ê¡¢
520 libc 5.2.5 °Ê¹ß¤ÇÍøÍѤǤ­¤ë¡£
521
522 .\"O POSIX.1-2001 says:
523 .\"O "The
524 .\"O .BR asctime (),
525 .\"O .BR ctime (),
526 .\"O .BR gmtime (),
527 .\"O and
528 .\"O .BR localtime ()
529 .\"O functions shall return values in one of two static objects:
530 .\"O a broken-down time structure and an array of type
531 .\"O .IR char .
532 .\"O Execution of any of the functions may overwrite the information returned
533 .\"O in either of these objects by any of the other functions."
534 .\"O This can occur in the glibc implementation.
535 POSIX.1-2001 ¤Ç¤Ï¡¢¡Ö´Ø¿ô
536 .BR asctime (),
537 .BR ctime (),
538 .BR gmtime (),
539 .BR localtime ()
540 ¤Ï¡¢Í×ÁÇÊ̤λþ¹ï¤Î¹½Â¤ÂΤ«
541 .I char
542 ·¿¤ÎÇÛÎ󤫤ΤɤÁ¤é¤«¤ÎÀÅŪ¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¤â¤Î¤È¤¹¤ë¡£
543 ¤³¤ì¤é¤Î´Ø¿ô¤Î¤¤¤º¤ì¤«¤ò¼Â¹Ô¤¹¤ë¤È¡¢Â¾¤Î´Ø¿ô¤Î¤É¤ì¤«¤¬¤³¤ì¤é¤Î
544 ÀÅŪ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤É¤Á¤é¤«¤Ë³ÊǼ¤·¤ÆÊÖ¤·¤¿¾ðÊ󤬾å½ñ¤­¤µ¤ì¤ë¤«¤â
545 ¤·¤ì¤Ê¤¤¡£¡×¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
546 ¤³¤Î¤³¤È¤Ï glibc ¤Î¼ÂÁõ¤Çµ¯¤³¤ê¤¦¤ë¡£
547 .LP
548 .\"O In many implementations, including glibc, a 0 in
549 .\"O .I tm_mday
550 .\"O is interpreted as meaning the last day of the preceding month.
551 glibc ¤ò´Þ¤à¿¤¯¤Î¼ÂÁõ¤Ç¤Ï¡¢
552 .I tm_mday
553 ¤Ë 0 ¤ò»ØÄꤹ¤ë¤ÈÁ°·î¤ÎºÇ½ªÆü¤ò°ÕÌ£¤·¤Æ¤¤¤ë¤È²ò¼á¤µ¤ì¤ë¡£
554 .LP
555 .\"O The glibc version of \fIstruct tm\fP has additional fields
556 .\"O .sp
557 .\"O .RS
558 .\"O .nf
559 .\"O long tm_gmtoff;           /* Seconds east of UTC */
560 .\"O const char *tm_zone;      /* Timezone abbreviation */
561 .\"O .fi
562 .\"O .RE
563 .\"O .sp
564 .\"O defined when
565 .\"O .B _BSD_SOURCE
566 .\"O was set before including
567 .\"O .IR <time.h> .
568 glibc ¤Ç¤Ï¡¢
569 .I <time.h>
570 ¤¬¥¤¥ó¥¯¥ë¡¼¥É¤µ¤ì¤ëÁ°¤Ë
571 .B _BSD_SOURCE
572 ¤¬ÄêµÁ¤µ¤ì¤ë¤È¡¢
573 \fIstruct tm\fP ¤Ë°Ê²¼¤Î¥Õ¥£¡¼¥ë¥É¤¬Äɲ䵤ì¤ë¡£
574 .sp
575 .RS
576 .nf
577 long tm_gmtoff;           /* Seconds east of UTC */
578 const char *tm_zone;      /* Timezone abbreviation */
579 .fi
580 .RE
581 .sp
582 .\"O This is a BSD extension, present in 4.3BSD-Reno.
583 ¤³¤ì¤Ï BSD ³ÈÄ¥¤Ç¤¢¤ê¡¢4.3BSD-Reno ¤«¤é¸½¤ì¤¿¡£
584
585 .\"O According to POSIX.1-2004,
586 .\"O .BR localtime ()
587 .\"O is required to behave as though
588 .\"O .BR tzset (3)
589 .\"O was called, while
590 .\"O .BR localtime_r ()
591 .\"O does not have this requirement.
592 .\"O .\" See http://thread.gmane.org/gmane.comp.time.tz/2034/
593 .\"O For portable code
594 .\"O .BR tzset (3)
595 .\"O should be called before
596 .\"O .BR localtime_r ().
597 POSIX.1-2004 ¤Ë¤è¤ë¤È¡¢
598 .BR localtime ()
599 ¤Ï¤¢¤¿¤«¤â
600 .BR tzset (3)
601 ¤¬¸Æ¤Ð¤ì¤¿¤«¤Î¤è¤¦¤Ë¿¶Éñ¤¦¤³¤È¤¬Í׵ᤵ¤ì¤Æ¤¤¤ë¤¬¡¢
602 .BR localtime_r ()
603 ¤Ë¤Ï¤³¤ÎÍ×·ï¤Ï¤Ê¤¤¡£
604 .\" http://thread.gmane.org/gmane.comp.time.tz/2034/ ¤ò»²¾È¡£
605 °Ü¿¢À­¤¬É¬Íפʥ³¡¼¥É¤Ç¤Ï¡¢
606 .BR localtime_r ()
607 ¤ÎÁ°¤Ë
608 .BR tzset (3)
609 ¤ò¸Æ¤Ó½Ð¤·¤Æ¤ª¤¯¤Ù¤­¤Ç¤¢¤ë¡£
610 .\"O .SH "SEE ALSO"
611 .SH ´ØÏ¢¹àÌÜ
612 .BR date (1),
613 .BR gettimeofday (2),
614 .BR time (2),
615 .BR utime (2),
616 .BR clock (3),
617 .BR difftime (3),
618 .BR strftime (3),
619 .BR strptime (3),
620 .BR timegm (3),
621 .BR tzset (3),
622 .BR time (7)