OSDN Git Service

(split) DP: release pages (catch up to 3.50).
[linuxjm/LDP_man-pages.git] / release / man3 / timegm.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .TH TIMEGM 3 2007\-07\-26 GNU "Linux Programmer's Manual"
31 .SH 名前
32 timegm, timelocal \- gmtime と localtime の逆関数
33 .SH 書式
34 .nf
35 \fB#include <time.h>\fP
36 .sp
37 \fBtime_t timelocal(struct tm *\fP\fItm\fP\fB);\fP
38 .sp
39 \fBtime_t timegm(struct tm *\fP\fItm\fP\fB);\fP
40 .sp
41 .fi
42 .in -4n
43 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
44 .in
45 .sp
46 \fBtimelocal\fP(), \fBtimegm\fP(): _BSD_SOURCE || _SVID_SOURCE
47 .SH 説明
48 \fBtimelocal\fP()  関数と \fBtimegm\fP()  関数は、それぞれ \fBlocaltime\fP(3)  関数と \fBgmtime\fP(3)
49 関数の逆関数である。
50 .SH 準拠
51 これらの関数は非標準で GNU の拡張である。 BSD 系にも存在する。 これらの使用は避けること。「注意」参照。
52 .SH 注意
53 \fBtimelocal\fP()  関数は POSIX の標準関数 \fBmktime\fP(3)  と同じものである。 ので、これを使う理由はないはずである。
54 .LP
55 \fBtimegm\fP()  を移植性があるようなかたちで実現するには、 \fBTZ\fP 環境変数を UTC に設定してから \fBmktime\fP(3)
56 を呼んで、 \fBTZ\fP の値を取得すればよい。 例えば次のようになるだろう。
57
58 .in +4n
59 .nf
60 #include <time.h>
61 #include <stdlib.h>
62
63 time_t my_timegm (struct tm *tm)
64 {
65     time_t ret;
66     char *tz;
67
68     tz = getenv("TZ");
69     setenv("TZ", "", 1);
70     tzset();
71     ret = mktime(tm);
72     if (tz)
73         setenv("TZ", tz, 1);
74     else
75         unsetenv("TZ");
76     tzset();
77     return ret;
78 }
79 .fi
80 .in
81 .SH 関連項目
82 \fBgmtime\fP(3), \fBlocaltime\fP(3), \fBmktime\fP(3), \fBtzset\fP(3)
83 .SH この文書について
84 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
85 である。プロジェクトの説明とバグ報告に関する情報は
86 http://www.kernel.org/doc/man\-pages/ に書かれている。