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
|
.\" 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
.\"
.\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya
.\" all rights reserved.
.\" Translated Mon Feb 10 1997 by Hiroaki Nagoya <nagoya@is.titech.ac.jp>
.\" Updated Mon Sep 1 JST 1999 by Kentaro Shirakata <argrath@ub32.org>
.\" Updated Mon Oct 15 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
.\" Updated Thu Dec 13 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
.\" Updated Thu Jan 3 JST 2002 by Kentaro Shirakata <argrath@ub32.org>
.\"
.\"WORD: Coordinated Univarsal Time
.\"WORD: broken-down time ̤λ
.TH CTIME 3 2001-11-13 "" "Linux Programmer's Manual"
.SH ̾
asctime, ctime, gmtime, localtime, mktime \- ХʥǡȻ̤λ 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
ÿդĤ 0 59 ޤǤ͡
äΤ 61 ޤǤͤϵ롣
.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' Ǥ롣
֤ͤŪΰ˳ݤ줿ʸؤΥݥǤ롣ΰ
ǤդաؿθƤӽФˤäƾ줦롣
ޤδؿѿ \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 acstime() ,
.BR ctime() ,
.BR gmtime() ,
.B localtime()
4 ĤδؿŪǡؤΥݥ֤ΤǡåɥդǤϤʤ
δؿΥåɥǤǤ
.BR acstime_r() ,
.BR ctime_r() ,
.BR gmtime_r() ,
.B localtime_r()
SUSv2 ǵꤵ졢libc 5.2.5 ʹߤѤǤ롣
.LP
glibc Ǥϡ
.I <time.h>
롼ɤ _BSD_SOURCE ȡ
struct tm ˰ʲΥեɤɲä롣
.sp
.RS
.nf
long tm_gmtoff; /* Seconds east of UTC */
const char *tm_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 newctime (3),
.BR time (2),
.BR utime (2),
.BR clock (3),
.BR difftime (3),
.BR strftime (3),
.BR strptime (3),
.BR tzset (3)
|