X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=release%2Fman3%2Ftimegm.3;h=6972e1299ace2732db49cf28109f4e7a8a7c97d6;hb=dba08e2eee1afb613e4e8e9310eb752cb06f45de;hp=17bace9a5e82600916acdf5db4e874c97b3c102a;hpb=ce024239a1d8e74a7a44f7c24cee4375cb13b3ef;p=linuxjm%2FLDP_man-pages.git diff --git a/release/man3/timegm.3 b/release/man3/timegm.3 index 17bace9a..6972e129 100644 --- a/release/man3/timegm.3 +++ b/release/man3/timegm.3 @@ -1,5 +1,6 @@ .\" Copyright (C) 2001 Andries Brouwer .\" +.\" %%%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. @@ -19,61 +20,45 @@ .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* +.\" +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2002 NAKANO Takeo all rights reserved. .\" Translated Thu 3 Jan 2002 by NAKANO Takeo .\" -.TH TIMEGM 3 2007-07-26 "GNU" "Linux Programmer's Manual" +.TH TIMEGM 3 2013\-07\-04 GNU "Linux Programmer's Manual" .SH 名前 timegm, timelocal \- gmtime と localtime の逆関数 .SH 書式 .nf -.B #include +\fB#include \fP .sp -.BI "time_t timelocal(struct tm *" tm ); +\fBtime_t timelocal(struct tm *\fP\fItm\fP\fB);\fP .sp -.BI "time_t timegm(struct tm *" tm ); +\fBtime_t timegm(struct tm *\fP\fItm\fP\fB);\fP .sp .fi .in -4n -glibc 向けの機能検査マクロの要件 -.RB ( feature_test_macros (7) -参照): +glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp -.BR timelocal (), -.BR timegm (): -_BSD_SOURCE || _SVID_SOURCE +\fBtimelocal\fP(), \fBtimegm\fP(): _BSD_SOURCE || _SVID_SOURCE .SH 説明 -.BR timelocal () -関数と -.BR timegm () -関数は、それぞれ -.BR localtime (3) -関数と -.BR gmtime (3) +\fBtimelocal\fP() 関数と \fBtimegm\fP() 関数は、それぞれ \fBlocaltime\fP(3) 関数と \fBgmtime\fP(3) 関数の逆関数である。 .SH 準拠 -これらの関数は非標準で GNU の拡張である。 -BSD 系にも存在する。 -これらの使用は避けること。「注意」参照。 +これらの関数は非標準で GNU の拡張である。 BSD 系にも存在する。 これらの使用は避けること。「注意」参照。 .SH 注意 -.BR timelocal () -関数は POSIX の標準関数 -.BR mktime (3) -と同じものである。 -ので、これを使う理由はないはずである。 +\fBtimelocal\fP() 関数は POSIX の標準関数 \fBmktime\fP(3) と同じものである。 ので、これを使う理由はないはずである。 .LP -.BR timegm () -を移植性があるようなかたちで実現するには、 -.B TZ -環境変数を UTC に設定してから -.BR mktime (3) -を呼んで、 -.B TZ -の値を取得すればよい。 -例えば次のようになるだろう。 -.sp +\fBtimegm\fP() を移植性があるようなかたちで実現するには、 \fBTZ\fP 環境変数を UTC に設定してから \fBmktime\fP(3) +を呼んで、 \fBTZ\fP の値を取得すればよい。 例えば次のようになるだろう。 + .in +4n .nf #include @@ -85,12 +70,15 @@ time_t my_timegm (struct tm *tm) char *tz; tz = getenv("TZ"); + if (tz) + tz = strdup(tz); setenv("TZ", "", 1); tzset(); ret = mktime(tm); - if (tz) + if (tz) { setenv("TZ", tz, 1); - else + free(tz); + } else unsetenv("TZ"); tzset(); return ret; @@ -98,7 +86,8 @@ time_t my_timegm (struct tm *tm) .fi .in .SH 関連項目 -.BR gmtime (3), -.BR localtime (3), -.BR mktime (3), -.BR tzset (3) +\fBgmtime\fP(3), \fBlocaltime\fP(3), \fBmktime\fP(3), \fBtzset\fP(3) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。