X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman3%2Fgetdate.3;h=3b8369e84aa61d76fc07e3c20b85153b7960b638;hb=98e1646bfadb3c9911212e817811c4d30ca1fec5;hp=9fb7dbb2c13a099f4ca56ea74151a31f4b665a9b;hpb=4a0386e39e89bfc6e52c4cd5372b1a0d9c9bf08c;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man3/getdate.3 b/draft/man3/getdate.3 index 9fb7dbb2..3b8369e8 100644 --- a/draft/man3/getdate.3 +++ b/draft/man3/getdate.3 @@ -2,6 +2,7 @@ .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk .\" .\" +.\" %%%LICENSE_START(VERBATIM) .\" 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. @@ -21,347 +22,146 @@ .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END .\" .\" Modified, 2001-12-26, aeb .\" 2008-09-07, mtk, Various rewrites; added an example program. .\" -.\" Japanese Version Copyright (c) 2002 NAKANO Takeo -.\" and Copyright (c) 2008, Akihiro MOTOKI all rights reserved. +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. .\" -.\" Translated 2002-01-12, NAKANO Takeo -.\" Updated 2008-09-20, Akihiro MOTOKI , LDP v3.09 +.\"******************************************************************* .\" -.\"WORD: broken-down time Í×ÁÇÊ̤λþ¹ï +.\" Japanese Version Copyright (c) 2002 NAKANO Takeo +.\" and Copyright (c) 2008, Akihiro MOTOKI all rights reserved. .\" -.TH GETDATE 3 2010-09-20 "" "Linux Programmer's Manual" -.\"O .SH NAME -.SH ̾Á° -.\"O getdate, getdate_r \- convert a date-plus-time string to broken-down time -getdate, getdate_r \- ÆüÉդȻþ¹ï¤Îʸ»úÎó¤òÍ×ÁÇÊ̤λþ¹ï¤ËÊÑ´¹¤¹¤ë -.\"O .SH SYNOPSIS -.SH ½ñ¼° -.B "#include " +.TH GETDATE 3 2014\-06\-13 "" "Linux Programmer's Manual" +.SH 名前 +getdate, getdate_r \- 日付と時刻の文字列を要素別の時刻に変換する +.SH 書式 +\fB#include \fP .sp -.BI "struct tm *getdate(const char *" string ); +\fBstruct tm *getdate(const char *\fP\fIstring\fP\fB);\fP .sp -.B "extern int getdate_err;" +\fBextern int getdate_err;\fP .sp -.B "#include " +\fB#include \fP .sp -.BI "int getdate_r(const char *" string ", struct tm *" res ); +\fBint getdate_r(const char *\fP\fIstring\fP\fB, struct tm *\fP\fIres\fP\fB);\fP .sp .in -4n -.\"O Feature Test Macro Requirements for glibc (see -.\"O .BR feature_test_macros (7)): -glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï -.RB ( feature_test_macros (7) -»²¾È): +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp -.BR getdate (): +\fBgetdate\fP(): .ad l .RS 4 -_XOPEN_SOURCE\ >=\ 500 || -_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED +_XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .br -.BR getdate_r (): +\fBgetdate_r\fP(): .ad l .RS 4 _GNU_SOURCE .RE .ad -.\"O .SH DESCRIPTION -.SH ÀâÌÀ -.\"O The function -.\"O .BR getdate () -.\"O converts a string representation of a date and time, -.\"O contained in the buffer pointed to by -.\"O .IR string , -.\"O into a broken-down time. -.BR getdate () -´Ø¿ô¤Ï¡¢ -.I string -¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤µ¤ì¤¿Ê¸»úÎóɽ¸½¤ÎÆüÉդȻþ¹ï¤ò¡¢ -Í×ÁÇÊ̤λþ¹ï (broken-down time) ¤ËÊÑ´¹¤¹¤ë¡£ -.\"O The broken-down time is stored in a -.\"O .I tm -.\"O structure, and a pointer to this -.\"O structure is returned as the function result. -.\"O This -.\"O .I tm -.\"O structure is allocated in static storage, -.\"O and consequently it will be overwritten by further calls to -.\"O .BR getdate (). -Í×ÁÇÊ̤λþ¹ï¤Ï -.I tm -¹½Â¤ÂΤ˳ÊǼ¤µ¤ì¡¢¤³¤Î¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤¬´Ø¿ô¤Î·ë²Ì¤È¤·¤ÆÊÖ¤µ¤ì¤ë¡£ -¤³¤Î -.I tm -¹½Â¤ÂΤÏÀÅŪ¤Ê¥á¥â¥êÎΰè¤Ë¤¢¤ê¡¢ -.BR getdate () -¤Î¤½¤ì°Ê¹ß¤Î¸Æ¤Ó½Ð¤·¤Ç¾å½ñ¤­¤µ¤ì¤ë¤«¤â¤µ¤ì¤Ê¤¤¡£ -.\"O -.PP -.\"O In contrast to -.\"O .BR strptime (3), -.\"O (which has a -.\"O .I format -.\"O argument), -.\"O .BR getdate () -.\"O uses the formats found in the file -.\"O whose full pathname is given in the environment variable -.\"O .BR DATEMSK . -.\"O The first line in the file that matches the given input string -.\"O is used for the conversion. -.RI ( format -°ú¤­¿ô¤Ç¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë) -.BR strptime (3) -¤È¤Ï°ã¤¤¡¢ -.BR getdate () -¤Ï´Ä¶­ÊÑ¿ô -.B DATEMSK -¤Ç»ØÄꤵ¤ì¤¿¥Õ¥ë¥Ñ¥¹Ì¾¤Î¥Õ¥¡¥¤¥ë¤Ë½ñ¤¤¤Æ¤¢¤ë¥Õ¥©¡¼¥Þ¥Ã¥È¤òÍѤ¤¤ë¡£ -.\"O -.PP -.\"O The matching is done case insensitively. -.\"O Superfluous whitespace, either in the pattern or in the string to -.\"O be converted, is ignored. -¥Þ¥Ã¥Á¤ÎºÝ¤Ë¤ÏÂçʸ»ú¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤¡£ -¥Ñ¥¿¡¼¥óÃæ¤Ç¤âÊÑ´¹¤µ¤ì¤ëʸ»úÎóÃæ¤Ç¤â¡¢Í¾Ê¬¤Ê¶õÇòʸ»ú¤Ï̵»ë¤µ¤ì¤ë¡£ -.\"O -.PP -.\"O The conversion specifications that a pattern can contain are those given for -.\"O .BR strptime (3). -.\"O One more conversion specification is specified in POSIX.1-2001: -¥Ñ¥¿¡¼¥ó¤Ë»ØÄê¤Ç¤­¤ëÊÑ´¹»ØÄê¤Ï¡¢ -.BR strptime (3) -¤Î¤â¤Î¤ÈƱ¤¸¤Ç¤¢¤ë¡£ -POSIX.1-2001 ¤Ç¤Ï°ì¤Ä¤ÎÊÑ´¹»ØÄ꤬Äɲäǵ¬Äꤵ¤ì¤Æ¤¤¤ë¡£ -.TP -.B %Z -.\"O Timezone name. -.\"O This is not implemented in glibc. -¥¿¥¤¥à¥¾¡¼¥ó¤Î̾Á°¡£ -glibc ¤Ç¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£ +.SH 説明 +\fBgetdate\fP() 関数は、 \fIstring\fP が指すバッファに格納された文字列表現の日付と時刻を、 要素別の時刻 (broken\-down +time) に変換する。 要素別の時刻は \fItm\fP 構造体に格納され、この構造体へのポインタが関数の結果として返される。 この \fItm\fP +構造体は静的なメモリ領域にあり、 \fBgetdate\fP() のそれ以降の呼び出しで上書きされるかもされない。 + +(\fIformat\fP 引き数でフォーマットを指定する) \fBstrptime\fP(3) とは違い、 \fBgetdate\fP() は環境変数 +\fBDATEMSK\fP で指定されたフルパス名のファイルに書いてあるフォーマットを用いる。 + +マッチの際には大文字小文字を区別しない。 パターン中でも変換される文字列中でも、余分な空白文字は無視される。 + +パターンに指定できる変換指定は、 \fBstrptime\fP(3) のものと同じである。 POSIX.1\-2001 +では一つの変換指定が追加で規定されている。 +.TP +\fB%Z\fP +タイムゾーンの名前。 glibc では実装されていない。 .LP -.\"O When -.\"O .B %Z -.\"O is given, the structure containing the broken-down time -.\"O is initialized with values corresponding to the current -.\"O time in the given timezone. -.\"O Otherwise, the structure is initialized to the broken-down time -.\"O corresponding to the current local time (as by a call to -.\"O .BR localtime (3)). -.B %Z -¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢Í×ÁÇÊ̤λþ¹ï¤ò³ÊǼ¤¹¤ë¹½Â¤ÂΤϡ¢ -»ØÄꤵ¤ì¤¿¥¿¥¤¥à¥¾¡¼¥ó¤Ë¤ª¤±¤ë¸½ºß»þ¹ï¤ËÂбþ¤¹¤ëÃͤǽé´ü²½¤µ¤ì¤ë¡£ -»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç¡¢¤³¤Î¹½Â¤ÂΤϸ½ºß¤Î¥í¡¼¥«¥ë¥¿¥¤¥à¤ËÂбþ¤¹¤ë -Í×ÁÇÊ̤λþ¹ï¤Ç½é´ü²½¤µ¤ì¤ë -.RB ( localtime (3) -¤ò¸Æ¤Ó½Ð¤·¤¿¾ì¹ç¤ÈƱ¤¸)¡£ +\fB%Z\fP が指定された場合、要素別の時刻を格納する構造体は、 指定されたタイムゾーンにおける現在時刻に対応する値で初期化される。 +指定されていない場合、この構造体は現在のローカルタイムに対応する 要素別の時刻で初期化される (\fBlocaltime\fP(3) +を呼び出した場合と同じ)。 .LP -.\"O When only the weekday is given, the day is taken to be the first such day -.\"O on or after today. -ÍËÆü¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢ -º£Æü¤Þ¤¿¤Ïº£Æü°Ê¹ß¤Ç¡¢ -¤½¤ÎÍËÆü¤Ë¹çÃפ¹¤ëºÇ½é¤ÎÆü¤¬ºÎÍѤµ¤ì¤ë¡£ +曜日だけが指定された場合、 今日または今日以降で、 その曜日に合致する最初の日が採用される。 .LP -.\"O When only the month is given (and no year), the month is taken to -.\"O be the first such month equal to or after the current month. -.\"O If no day is given, it is the first day of the month. -(ǯ¤Ê¤·¤Ç) ·î¤À¤±¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢ -º£·î¤Þ¤¿¤Ïº£·î°Ê¹ß¤Ç¡¢ -¤½¤Î·î¤Ë¹çÃפ¹¤ëºÇ½é¤Î·î¤¬ºÎÍѤµ¤ì¤ë¡£ +(年なしで) 月だけが指定された場合、 今月または今月以降で、 その月に合致する最初の月が採用される。 .LP -.\"O When no hour, minute and second are given, the current -.\"O hour, minute and second are taken. -»þ¡¦Ê¬¡¦É䬤¤¤º¤ì¤â»ØÄꤵ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¡¢ -¸½ºß¤Î»þ¡¦Ê¬¡¦É䬺ÎÍѤµ¤ì¤ë¡£ +時・分・秒がいずれも指定されなかった場合、 現在の時・分・秒が採用される。 .LP -.\"O If no date is given, but we know the hour, then that hour is taken -.\"O to be the first such hour equal to or after the current hour. -ÆüÉդλØÄ꤬¤Ê¤«¤Ã¤¿¤¬¡¢»þ´Ö (hour) ¤À¤±»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢ -¸½ºß¤Î»þ´Ö¤Þ¤¿¤Ï¤½¤ì°Ê¹ß¤Ç¡¢¤½¤Î»ØÄê¤Ë¹çÃפ¹¤ëºÇ½é¤Î»þ´Ö¤¬ºÎÍѤµ¤ì¤ë¡£ +日付の指定がなかったが、時間 (hour) だけ指定された場合は、 現在の時間またはそれ以降で、その指定に合致する最初の時間が採用される。 -.\"O .BR getdate_r () -.\"O is a GNU extension that provides a reentrant version of -.\"O .BR getdate (). -.\"O Rather than using a global variable to report errors and a static buffer -.\"O to return the broken down time, -.\"O it returns errors via the function result value, -.\"O and returns the resulting broken-down time in the -.\"O caller-allocated buffer pointed to by the argument -.\"O .IR res . -.BR getdate_r () -¤Ï GNU ³ÈÄ¥¤Ç -.BR getdate () -¤Î¥ê¥¨¥ó¥È¥é¥ó¥ÈÈǤòÄ󶡤·¤Æ¤¤¤ë¡£ -.BR getdate_r () -¤Ç¤Ï¡¢¥¨¥é¡¼¤òÊó¹ð¤¹¤ë¤Î¤Ë¥°¥í¡¼¥Ð¥ëÊÑ¿ô¤ò»ÈÍѤ·¤¿¤ê¡¢ -Í×ÁÇÊ̤λþ¹ï¤òÊÖ¤¹¤Î¤ËÀÅŪ¤Ê¥Ð¥Ã¥Õ¥¡¤ò»ÈÍѤ·¤¿¤ê¤»¤º¡¢ -¥¨¥é¡¼¤ò´Ø¿ô¤ÎÊÖ¤êÃÍ·Ðͳ¤ÇÊó¹ð¤·¡¢Í×ÁÇÊ̤λþ¹ï¤ò -°ú¤­¿ô -.I res -¤¬»Ø¤·¼¨¤¹¸Æ¤Ó½Ð¤·Â¦¤Ç³ä¤êÅö¤Æ¤¿¥Ð¥Ã¥Õ¥¡¤Ë³ÊǼ¤·¤ÆÊÖ¤¹¡£ -.\"O .SH "RETURN VALUE" -.SH ÊÖ¤êÃÍ -.\"O When successful, -.\"O .BR getdate () -.\"O returns a pointer to a -.\"O .IR "struct tm" . -.\"O Otherwise, it returns NULL and sets the global variable -.\"O .IR getdate_err -.\"O to one of the error numbers shown below. -.\"O Changes to -.\"O .I errno -.\"O are unspecified. -À®¸ù¤¹¤ë¤È¡¢ -.BR getdate () -¤Ï -.I struct tm -¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£ -¼ºÇÔ¤¹¤ë¤È NULL ¤òÊÖ¤·¡¢¥°¥í¡¼¥Ð¥ëÊÑ¿ô -.I getdate_err -¤Ë°Ê²¼¤Ë¼¨¤¹¥¨¥é¡¼ÈÖ¹æ¤Î¤¤¤º¤ì¤«°ì¤Ä¤òÀßÄꤹ¤ë¡£ -.I errno -¤ÎÊѹ¹¤Ë¤Ä¤¤¤Æ¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£ +\fBgetdate_r\fP() は GNU 拡張で \fBgetdate\fP() のリエントラント版を提供している。 \fBgetdate_r\fP() +では、エラーを報告するのにグローバル変数を使用したり、 要素別の時刻を返すのに静的なバッファを使用したりせず、 +エラーを関数の返り値経由で報告し、要素別の時刻を 引き数 \fIres\fP が指し示す呼び出し側で割り当てたバッファに格納して返す。 +.SH 返り値 +成功すると、 \fBgetdate\fP() は \fIstruct tm\fP へのポインタを返す。 失敗すると NULL を返し、グローバル変数 +\fIgetdate_err\fP に以下に示すエラー番号のいずれか一つを設定する。 \fIerrno\fP の変更については規定されていない。 -.\"O On success -.\"O .BR getdate_r () -.\"O returns 0; -.\"O on error it returns one of the error numbers shown below. -À®¸ù¤¹¤ë¤È¡¢ -.BR getdate_r () -¤Ï 0 ¤òÊÖ¤¹¡£ -¼ºÇÔ¤¹¤ë¤È¡¢°Ê²¼¤Ë¼¨¤¹¥¨¥é¡¼ÈÖ¹æ¤Î¤¤¤º¤ì¤«°ì¤Ä¤òÊÖ¤¹¡£ -.\"O .SH ERRORS -.SH ¥¨¥é¡¼ -.\"O The following errors are returned via -.\"O .IR getdate_err -.\"O (for -.\"O .BR getdate ()) -.\"O or as the function result (for -.\"O .BR getdate_r ()): -°Ê²¼¤Î¥¨¥é¡¼¤¬¡¢ -.RB ( getdate () -¤Ç¤Ï) -.I getdate_err -·Ðͳ¤ÇÊÖ¤µ¤ì¡¢ -.RB ( getdate_r () -¤Ç¤Ï) ´Ø¿ô¤ÎÊÖ¤êÃͤȤ·¤ÆÊÖ¤µ¤ì¤ë¡£ -.TP 4n -.B 1 -.\"O The -.\"O .B DATEMSK -.\"O environment variable is not defined, or its value is an empty string. -´Ä¶­ÊÑ¿ô -.B DATEMASK -¤¬Ì¤ÄêµÁ¡¢¤Þ¤¿¤Ï¤½¤ÎÃͤ¬¶õʸ»úÎó¤Ç¤¢¤ë¡£ -.TP -.B 2 -.\"O The template file specified by -.\"O .B DATEMSK -.\"O cannot be opened for reading. -.B DATEMSK -¤Ç»ØÄꤵ¤ì¤¿¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ßÍѤ˥ª¡¼¥×¥ó¤Ç¤­¤Ê¤¤¡£ -.TP -.B 3 -.\"O Failed to get file status information. -¥Õ¥¡¥¤¥ë¤Î¥¹¥Æ¡¼¥¿¥¹¾ðÊ󤬼èÆÀ¤Ç¤­¤Ê¤¤¡£ +成功すると、 \fBgetdate_r\fP() は 0 を返す。 失敗すると、以下に示すエラー番号のいずれか一つを返す。 +.SH エラー +以下のエラーが、 (\fBgetdate\fP() では) \fIgetdate_err\fP 経由で返され、 (\fBgetdate_r\fP() では) +関数の返り値として返される。 +.TP 4n +\fB1\fP +環境変数 \fBDATEMASK\fP が未定義、またはその値が空文字列である。 +.TP +\fB2\fP +\fBDATEMSK\fP で指定されたテンプレートファイルを読み込み用にオープンできない。 +.TP +\fB3\fP .\" stat() -.TP -.B 4 -.\"O The template file is not a regular file. -¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤Ê¤¤¡£ -.TP -.B 5 -.\"O An error was encountered while reading the template file. -¥Æ¥ó¥×¥ì¡¼¥È¥Õ¥¡¥¤¥ë¤ÎÆɤ߹þ¤ßÃæ¤Ë¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£ -.TP -.B 6 -.\"O Memory allocation failed (not enough memory available). -.\"O .\" Error 6 doesn't seem to occur in glibc -¥á¥â¥ê¤Î³ä¤êÅö¤Æ¤Ë¼ºÇÔ¤·¤¿ (¥á¥â¥ê¤¬Â­¤ê¤Ê¤¤)¡£ -.\" ¥¨¥é¡¼ 6 ¤Ï glibc ¤Ç¤ÏȯÀ¸¤·¤Ê¤¤¤è¤¦¤Ë¸«¤¨¤ë¡£ -.TP -.B 7 -.\"O There is no line in the file that matches the input. -ÆþÎϤ˥ޥåÁ¤·¤¿¥Õ¥¡¥¤¥ë¤Ë¡¢¹Ô¤¬´Þ¤Þ¤ì¤Æ¤¤¤Ê¤¤¡£ -.TP -.B 8 -.\"O Invalid input specification. -ÆþÎÏ»ØÄ꤬Àµ¤·¤¯¤Ê¤¤¡£ -.\"O .SH ENVIRONMENT -.SH ´Ä¶­ÊÑ¿ô -.TP -.B DATEMSK -.\"O File containing format patterns. -½ñ¼°¥Ñ¥¿¡¼¥ó¤ò´Þ¤à¥Õ¥¡¥¤¥ë¡£ -.TP -.BR TZ ", " LC_TIME -.\"O Variables used by -.\"O .BR strptime (3). -.BR strptime (3) -¤¬ÍѤ¤¤ëÊÑ¿ô¡£ -.\"O .SH "CONFORMING TO" -.SH ½àµò -POSIX.1-2001. -.\"O .SH NOTES -.SH Ãí°Õ -.\"O The POSIX.1-2001 specification for -.\"O .BR strptime (3) -.\"O contains conversion specifications using the -.\"O .B %E -.\"O or -.\"O .B %O -.\"O modifier, while such specifications are not given for -.\"O .BR getdate (). -.\"O In glibc, -.\"O .BR getdate () -.\"O is implemented using -.\"O .BR strptime (3), -.\"O so that precisely the same conversions are supported by both. -POSIX.1-2001 »ÅÍͤǤϡ¢ -.BR strptime (3) -¤Ë¤Ä¤¤¤Æ¤Ï -.B %E -¤ä -.B %O -¤È¤¤¤Ã¤¿½¤Àµ»Ò¤òÍѤ¤¤¿ÊÑ´¹»ØÄê¤òµ¬Äꤷ¤Æ¤¤¤ë¤¬¡¢ -.BR getdate () -¤Ë¤Ä¤¤¤Æ¤Ï¤³¤Î¤è¤¦¤Ê½¤¾þ»Ò¤Îµ¬Äê¤Ï¤Ê¤¤¡£ -glibc ¤Ç¤Ï¡¢ -.BR getdate () -¤Ï -.BR strptime (3) -¤òÍѤ¤¤Æ¼ÂÁõ¤µ¤ì¤Æ¤ª¤ê¡¢ -ξ¼Ô¤Ç¤ÏÁ´¤¯Æ±¤¸ÊÑ´¹¤¬Î¾¼Ô¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£ -.\"O .SH EXAMPLE -.SH Îã -.\"O The program below calls -.\"O .BR getdate () -.\"O for each of its command-line arguments, -.\"O and for each call displays the values in the fields of the returned -.\"O .I tm -.\"O structure. -.\"O The following shell session demonstrates the operation of the program: -°Ê²¼¤Î¥×¥í¥°¥é¥à¤Ï¡¢¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¤­¿ô¤Î¤½¤ì¤¾¤ì¤Ë¤Ä¤¤¤Æ -.BR getdate () -¤ò¸Æ¤Ó½Ð¤·¡¢¤½¤ì¤¾¤ì¤Ë¤Ä¤¤¤ÆÊÖ¤µ¤ì¤¿ -.I tm -¹½Â¤ÂΤΥե£¡¼¥ë¥ÉÃͤòɽ¼¨¤¹¤ë¡£ -¼¡¤Î¥·¥§¥ë¡¦¥»¥Ã¥·¥ç¥ó¤Ï¡¢¥×¥í¥°¥é¥à¤ÎÆ°ºîÎã¤Ç¤¢¤ë¡£ +ファイルのステータス情報が取得できない。 +.TP +\fB4\fP +テンプレートファイルが通常のファイルでない。 +.TP +\fB5\fP +テンプレートファイルの読み込み中にエラーが起こった。 +.TP +\fB6\fP +.\" Error 6 doesn't seem to occur in glibc +メモリの割り当てに失敗した (メモリが足りない)。 +.TP +\fB7\fP +入力にマッチしたファイルに、行が含まれていない。 +.TP +\fB8\fP +入力指定が正しくない。 +.SH 環境変数 +.TP +\fBDATEMSK\fP +書式パターンを含むファイル。 +.TP +\fBTZ\fP, \fBLC_TIME\fP +\fBstrptime\fP(3) が用いる変数。 +.SH 属性 +.SS "マルチスレッディング (pthreads(7) 参照)" +\fBgetdate\fP() 関数はスレッドセーフではない。 +.LP +\fBgetdate_r\fP() 関数はスレッドセーフである。 +.SH 準拠 +POSIX.1\-2001. +.SH 注意 +POSIX.1\-2001 仕様では、 \fBstrptime\fP(3) については \fB%E\fP や \fB%O\fP +といった修正子を用いた変換指定を規定しているが、 \fBgetdate\fP() についてはこのような修飾子の規定はない。 glibc では、 +\fBgetdate\fP() は \fBstrptime\fP(3) を用いて実装されており、 両者では全く同じ変換が両者でサポートされている。 +.SH 例 +以下のプログラムは、コマンドライン引き数のそれぞれについて \fBgetdate\fP() を呼び出し、それぞれについて返された \fItm\fP +構造体のフィールド値を表示する。 次のシェル・セッションは、プログラムの動作例である。 .in +4n .nf -.RB "$" " TFILE=$PWD/tfile" -.RB "$" " echo \(aq%A\(aq > $TFILE " " # Full weekday name" -.RB "$" " echo \(aq%T\(aq >> $TFILE" " # ISO date (YYYY-MM-DD)" -.RB "$" " echo \(aq%F\(aq >> $TFILE" " # Time (HH:MM:SS)" -.RB "$" " date" -.RB "$" " export DATEMSK=$TFILE" -.RB "$" " ./a.out Tuesday \(aq2009-12-28\(aq \(aq12:22:33\(aq" +$\fB TFILE=$PWD/tfile\fP +$\fB echo \(aq%A\(aq > $TFILE \fP # Full name of the day of the week +$\fB echo \(aq%T\(aq >> $TFILE\fP # ISO date (YYYY\-MM\-DD) +$\fB echo \(aq%F\(aq >> $TFILE\fP # Time (HH:MM:SS) +$\fB date\fP +$\fB export DATEMSK=$TFILE\fP +$\fB ./a.out Tuesday \(aq2009\-12\-28\(aq \(aq12:22:33\(aq\fP Sun Sep 7 06:03:36 CEST 2008 Call 1 ("Tuesday") succeeded: tm_sec = 36 @@ -373,7 +173,7 @@ Call 1 ("Tuesday") succeeded: tm_wday = 2 tm_yday = 252 tm_isdst = 1 -Call 2 ("2009-12-28") succeeded: +Call 2 ("2009\-12\-28") succeeded: tm_sec = 36 tm_min = 3 tm_hour = 6 @@ -395,11 +195,10 @@ Call 3 ("12:22:33") succeeded: tm_isdst = 1 .fi .in -.\"O .SS Program source -.SS ¥×¥í¥°¥é¥à¤Î¥½¡¼¥¹ +.SS プログラムのソース \& .nf -#define _GNU_SOURCE 500 +#define _GNU_SOURCE #include #include #include @@ -414,30 +213,29 @@ main(int argc, char *argv[]) tmp = getdate(argv[j]); if (tmp == NULL) { - printf("Call %d failed; getdate_err = %d\\n", + printf("Call %d failed; getdate_err = %d\en", j, getdate_err); continue; } - printf("Call %d (\\"%s\\") succeeded:\\n", j, argv[j]); - printf(" tm_sec = %d\\n", tmp\->tm_sec); - printf(" tm_min = %d\\n", tmp\->tm_min); - printf(" tm_hour = %d\\n", tmp\->tm_hour); - printf(" tm_mday = %d\\n", tmp\->tm_mday); - printf(" tm_mon = %d\\n", tmp\->tm_mon); - printf(" tm_year = %d\\n", tmp\->tm_year); - printf(" tm_wday = %d\\n", tmp\->tm_wday); - printf(" tm_yday = %d\\n", tmp\->tm_yday); - printf(" tm_isdst = %d\\n", tmp\->tm_isdst); + printf("Call %d (\e"%s\e") succeeded:\en", j, argv[j]); + printf(" tm_sec = %d\en", tmp\->tm_sec); + printf(" tm_min = %d\en", tmp\->tm_min); + printf(" tm_hour = %d\en", tmp\->tm_hour); + printf(" tm_mday = %d\en", tmp\->tm_mday); + printf(" tm_mon = %d\en", tmp\->tm_mon); + printf(" tm_year = %d\en", tmp\->tm_year); + printf(" tm_wday = %d\en", tmp\->tm_wday); + printf(" tm_yday = %d\en", tmp\->tm_yday); + printf(" tm_isdst = %d\en", tmp\->tm_isdst); } exit(EXIT_SUCCESS); } .fi -.\"O .SH "SEE ALSO" -.SH ´ØÏ¢¹àÌÜ -.BR time (2), -.BR localtime (3), -.BR setlocale (3), -.BR strftime (3), -.BR strptime (3) +.SH 関連項目 +\fBtime\fP(2), \fBlocaltime\fP(3), \fBsetlocale\fP(3), \fBstrftime\fP(3), \fBstrptime\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.78 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。