1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 19:49:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Fri Apr 26 12:38:55 MET DST 1996 by Martin Schulze (joey@linux.de)
.\" Modified 2001-11-13, aeb
.\" Modified 2004-11-16, mtk
.\"
.\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
.\" all rights reserved.
.\" Translated 1997-02-10, Hiroaki Nagoya <nagoya@is.titech.ac.jp>
.\" Updated 1999-09-01, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2001-10-15, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2001-12-13, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2002-01-03, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD: Coordinated Univarsal Time
.\"WORD: broken-down time ̤λ
.\"
.TH CTIME 3 2004-11-16 "" "Linux Programmer's Manual"
.SH ̾
asctime, ctime, gmtime, localtime, mktime, asctime_r, ctime_r, gmtime_r,
localtime_r \- դȻ̤λ ASCII Ѵ
.SH
.nf
.B #include <time.h>
.sp
.BI "char *asctime(const struct tm *" tm );
.br
.BI "char *asctime_r(const struct tm *" tm ", char *" buf );
.sp
.BI "char *ctime(const time_t *" timep );
.br
.BI "char *ctime_r(const time_t *" timep ", char *" buf );
.sp
.BI "struct tm *gmtime(const time_t *" timep );
.br
.BI "struct tm *gmtime_r(const time_t *" timep ", struct tm *" result );
.sp
.BI "struct tm *localtime(const time_t *" timep );
.br
.BI "struct tm *localtime_r(const time_t *" timep ", struct tm *" result );
.sp
.BI "time_t mktime(struct tm *" tm );
.fi
.SH
ؿ \fBctime()\fP, \fBgmtime()\fP, \fBlocaltime()\fP
\fItime_t\fP ΥˤȤ롣
ϡ (UTC) 1970 ǯ 1 1 00:00:00
ηвÿȲᤵ롣
.PP
ؿ \fBasctime()\fP \fBmktime()\fP
ǯʤɤʬΥ줿̤λȤ롣
.PP
̤λ \fI<time.h>\fP ǰʲΤ褦Ƥ
\fItm\fP ¤Τݻ롣
.sp
.RS
.nf
.ne 11
.ta 8n 16n 32n
struct tm {
int tm_sec; /* */
int tm_min; /* ʬ */
int tm_hour; /* */
int tm_mday; /* */
int tm_mon; /* */
int tm_year; /* ǯ */
int tm_wday; /* */
int tm_yday; /* ǯ̻ */
int tm_isdst; /* ƻ */
};
.ta
.fi
.RE
.PP
\fItm\fP ¤ΤΥСϰʲ̤:
.TP
.I tm_sec
.\" motoki (): (leap second) 2 뤳ȤϤʤΤǡ
.\" 60 θȻפ롣
ÿդĤ 0 59 ޤǤ͡
äΤ 60 ޤǤͤϵ롣
.TP
.I tm_min
ʬ0 59 ޤǤ͡
.TP
.I tm_hour
椫̻֡0 23 ޤǤ͡
.TP
.I tm_mday
Ϥᤫ1 31 ޤǤ͡
.TP
.I tm_mon
1̻0 11 ޤǤ͡
.TP
.I tm_year
1900 ǯ̻ǯ
.TP
.I tm_wday
̻()0 6 ޤǤ͡
.TP
.I tm_yday
1 1 ̻0 365 ޤǤ͡
.TP
.I tm_isdst
ƻ֤ͭɤΥե饰
ͤʤвƻ֤ͭˤʤꡢ0 ʤ̵ͤʤФξˤ
̣ʤ
.PP
.BI ctime( t )
ؿϡ
.BI asctime(localtime( t ))
Ǥ롣
\fIt\fP
.sp
.RS
"Wed Jun 30 21:49:08 1993\\n"
.RE
.sp
ȤʸѴ롣
άΤ
`Sun', `Mon', `Tue', `Wed', `Thu', `Fri', `Sat' Ǥ롣
άΤ `Jan', `Feb', `Mar', `Apr', `May', `Jun', `Jul', `Aug',
`Sep', `Oct', `Nov', `Dec' Ǥ롣
֤ͤϡŪ (static) ˳Ƥ줿ʸؤΥݥǤ롣
ʸϡաؿΤ줫ƤӽФȾ뤳Ȥ롣
ޤδؿѿ \fItzname\fP ˸ߤΥॾξꤹ
.RB ( tzset (3)
)
ꥨȥǤǤ \fBctime_r()\fP Ʊͤ
ʸϥ桼ѰդХåե˳Ǽ롣ХåեΥ
ʤȤ 26 ʸʾǤʤФʤʤ
δؿ \fItzname\fP ꤹɬפϤʤ
.PP
ؿ \fBgmtime()\fP ϡ \fItimep\fP
(UTC) Ǥ̤λѴ롣
ǯ˼ޤʤ硢NULL ֤
֤ͤŪ˳ݤ줿¤ΤؤƤꡢθ
դ˴ؤؿΤ줫ƤӽФ
ǽ롣
\fBgmtime_r()\fP Ʊͤ
ǡϥ桼Ѱդ¤Τ˳Ǽ롣
.PP
ؿ \fBlocaltime()\fP ϡ桼ꤷॾǤλǤѴ롣
δؿ
.BR tzset (3)
ƤӽФΤ褦˿
ѿ \fItzname\fP ˸ߤΥॾξꤹ롣
ޤ\fItimezone\fP ˶ (UTC) ȥɸȤ
ÿꤷ
ǯΰDzƻ֤ŬѤ \fIdaylight\fP 0 ꤵ롣
֤ͤŪ˳ݤ줿¤ΤؤƤꡢθ
դ˴ؤؿΤ줫ƤӽФ
ǽ롣
\fBlocaltime_r()\fP Ʊͤ
ǡϥ桼Ѱդ¤Τ˳Ǽ롣
\fItzname\fP ꤹɬפϤʤ
.PP
ؿ \fBasctime()\fP ϡ̤λ \fItm\fP
\fBctime()\fP ƱʸѴ롣
֤ͤŪ˳Ƥ줿ʸؤΥݥǤ롣ʸϡ
աؿΤ줫ƤӽФȾ뤳Ȥ롣
ꥨȥǤǤ \fBasctime_r()\fP Ʊͤ
ʸϥ桼ѰդХåե˳Ǽ롣ХåեΥ
ʤȤ 26 ʸʾǤʤФʤʤ
.PP
ؿ \fBmktime()\fP ϡ(륿ǵҤƤ) ̤λ
Ѵ롣
δؿϻǤΤ \fItm_wday\fP \fItm_yday\fP ̵ͤ뤷
¾λǤ餽ͤƷ롣
¤ΤǤϰϤˤʤ硢
(Ĥޤꡢ10 40 11 9 ѹ)
ؿ \fBmktime()\fP ƤӽФȡ
ѿ \fItzname\fP ߤΥॾꤵ롣
̤λ (ÿ) ɽǤʤ硢
\fBmktime()\fP (time_t)(-1) ֤
\fItm_wday\fP \fItm_yday\fP ѹʤ
.SH ֤
ƴؿϤ줾Ҥ֤ͤ顼ξ NULL
(\fBmktime()\fP Ǥ \-1) ֤
.SH
.BR asctime() ,
.BR ctime() ,
.BR gmtime() ,
.B localtime()
4 ĤδؿŪǡؤΥݥ֤ΤǡåɥդǤϤʤ
δؿΥåɥǤǤ
.BR asctime_r() ,
.BR ctime_r() ,
.BR gmtime_r() ,
.B localtime_r()
SUSv2 ǵꤵƤꡢ
libc 5.2.5 ʹߤѤǤ롣
.LP
.I glibc
ޤ¿μǤϡ
.I tm_mday
0 ꤹκǽ̣ƤȲᤵ롣
.LP
glibc Ǥϡ
.I <time.h>
롼ɤ _BSD_SOURCE ȡ
struct tm ˰ʲΥեɤɲä롣
.sp
.RS
.nf
long tm_gmtoff; /* Seconds east of UTC */
const char *tm_zone; /* Timezone abbreviation */
.fi
.RE
.sp
BSD ĥǤꡢ4.3BSD-Reno 鸽줿
.SH
SVID 3, POSIX, BSD 4.3, ISO 9899
.SH Ϣ
.BR date (1),
.BR gettimeofday (2),
.BR time (2),
.BR utime (2),
.BR clock (3),
.BR difftime (3),
.BR newctime (3),
.BR strftime (3),
.BR strptime (3),
.BR tzset (3)
|