.\" .\" Copyright (c) 1997 Joerg Wunsch .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" %FreeBSD: src/lib/libc/stdtime/strptime.3,v 1.9.2.3 2000/12/29 14:44:51 ru Exp % .\" " .\" $FreeBSD$ .Dd May 8, 1997 .Dt STRPTIME 3 .Os .Sh 名称 .Nm strptime .Nd 日付および時刻を表す文字列を解釈する .Sh ライブラリ .Lb libc .Sh 書式 .Fd #include .Ft char * .Fn strptime "const char *buf" "const char *format" "struct tm *timeptr" .Sh 解説 .Fn strptime 関数は、バッファ .Fa buf 中の文字列を .Fa format で示される文字列に従って解釈し、 .Fa timeptr が指す構造体の要素に入れます。 .\" The resulting values will be relative to the local time zone. この結果は地域時間に適切に合わされます。 したがって、これは .Xr strftime 3 の逆方向の操作と考えることができます。 .Pp .Fa format 文字列は、 0 以上の変換則と通常文字からなります。 すべての通常文字は、バッファと厳密にマッチされます。 そして、フォーマット文字列の空白文字は バッファ中の任意の数の空白文字とマッチします。 すべての変換則は、 .Xr strftime 3 に記述したものと同じです。 .\".Pp .\"Two-digit year values, including formats .\".Fa %y .\"and .\".Fa \&%D , .\"are now interpreted as beginning at 1969 per POSIX requirements. .\"Years 69-00 are interpreted in the 20th century (1969-2000), years .\"01-68 in the 21st century (2001-2068). .Pp 形式に含まれる .Fa %y で示される 2 桁の年の値、および .Fa \&%D は、 POSIX 要求仕様によって 1969 年から始まるように解釈されます。 年が 69-00 の場合は 20 世紀 (1969-2000) と、 年が 01-68 の場合は 21 世紀 (2001-2068) と解釈されます。 .Sh 戻り値 成功して終了した場合、 .Fn strptime は .Fa format 中の変換指定を満たすためには必要とされなかった .Fa buf 中の最初の文字へのポインタを返します。 変換が一つでも失敗した場合は .Dv NULL を返します。 .Sh 参照 .Xr date 1 , .Xr scanf 3 , .Xr strftime 3 .Sh 作者 .Fn strptime 関数は、 Powerdog Industries によって寄贈されました。 .Pp このマニュアルページは、 .An J\(:org Wunsch . によって書かれました。 .Sh 歴史 .Fn strptime 関数は .Fx 3.0 で登場しました。 .\".Pp .\".Sh BUGS .\"Both the .\".Fa %e .\"and .\".Fa %l .\"format specifiers may incorrectly scan one too many digits .\"if the intended values comprise only a single digit .\"and that digit is followed immediately by another digit. .\"Both specifiers accept zero-padded values, .\"even though they are both defined as taking unpadded values. .Pp .Sh バグ 変換形式 .Fa %e と .Fa %l の両方は もし意図された値が一桁の数値だけで成り、 かつその数値にすぐに続けて他の整数が続く場合、 一桁を越えて不正確なスキャンを行います。 これらの変換形式には、たとえ詰めていない値を取得する場合でも 0 詰めした値を渡してください。 .\".Pp .\"The .\".Fa %p .\"format specifier has no effect unless it is parsed .\".Em after .\"hour-related specifiers. .\"Specifying .\".Fa %l .\"without .\".Fa %p .\"will produce undefined results. .\"Note that 12AM .\".Pq ante meridiem .\"is taken as midnight .\"and 12PM .\".Pq post meridiem .\"is taken as noon. .Pp 変換形式 .Fa %p は時間を示す変換形式が解析された .Em 後 でないと意味を持ちません。 変換形式 .Fa %l は .Fa %p が無いと未定義の結果を作り出します。 注 12AM .Pq 午前 は深夜を指し、12PM .Pq 午後 は正午を指します。 .\".Pp .\"The .\".Fa %U .\"and .\".Fa %W .\"format specifiers accept any value within the range 00 to 53 .\"without validating against other values supplied (like month .\"or day of the year, for example). .Pp 変換仕様 .Fa %U と .Fa %W は他の値 (例えば年の中の月や日など) を取得する場合とは対照に、 正当性の検査なしに 00 から 53 の範囲の中での値を受け付けます。 .\".Pp .\"The .\".Fa %Z .\"format specifier only accepts time zone abbreviations of the local time zone, .\"or the value "GMT". .\"This limitation is because of ambiguity due to of the over loading of time .\"zone abbreviations. One such example is .\".Fa EST .\"which is both Eastern Standard Time and Eastern Australia Summer Time. .Pp 変換仕様 .Fa %Z は時間帯として省略された地域時間か "GMT" のみを受け付けます。 この制限は多義的な時間帯の省略がオーバロードされる場合に影響します。 たとえば一つの例として .Fa EST は東部標準時と東部オーストラリア夏時間が挙げられます。