OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / draft / man3 / timeradd.3
1 .\" Copyright (c) 2007 by Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" 2007-07-31, mtk, Created
24 .\"
25 .\" Japanese Version Copyright (c) 2007  Akihiro MOTOKI
26 .\"         all rights reserved.
27 .\" Translated 2007-10-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.66
28 .\" Updated 2009-04-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.20
29 .\" 
30 .TH TIMERADD 3 2010-02-25 "Linux" "Linux Programmer's Manual"
31 .\"O .SH NAME
32 .SH 名前
33 .\"O timeradd, timersub, timercmp, timerclear, timerisset \- timeval operations
34 timeradd, timersub, timercmp, timerclear, timerisset \- timeval の操作
35 .\"O .SH SYNOPSIS
36 .SH 書式
37 .nf
38 .B #include <sys/time.h>
39
40 .BI "void timeradd(struct timeval *" a ", struct timeval *" b ,
41 .BI "              struct timeval *" res );
42
43 .BI "void timersub(struct timeval *" a ", struct timeval *" b ,
44 .BI "              struct timeval *" res );
45
46 .BI "void timerclear(struct timeval *" tvp );
47
48 .BI "int timerisset(struct timeval *" tvp );
49
50 .BI "int timercmp(struct timeval *" a ", struct timeval *" b ", " CMP );
51 .fi
52 .sp
53 .in -4n
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc 向けの機能検査マクロの要件
57 .RB ( feature_test_macros (7)
58 参照):
59 .in
60 .sp
61 .\"O All functions shown above:
62 上記の全ての関数:
63 _BSD_SOURCE
64 .\"O .SH DESCRIPTION
65 .SH 説明
66 .\"O The macros are provided to operate on
67 .\"O .I timeval
68 .\"O structures, defined in
69 .\"O .I <sys/time.h>
70 .\"O as:
71 .I timeval
72 構造体を操作するためのマクロが提供されている。
73 .I timeval
74 構造体は
75 .I <sys/time.h>
76 で以下のように定義されている。
77 .sp
78 .in +4n
79 .nf
80 struct timeval {
81 .\"O     time_t      tv_sec;     /* seconds */
82 .\"O     suseconds_t tv_usec;    /* microseconds */
83     time_t      tv_sec;     /* 秒 */
84     suseconds_t tv_usec;    /* マイクロ秒 */
85 };
86 .fi
87 .in
88 .PP
89 .\"O .BR timeradd ()
90 .\"O adds the time values in
91 .\"O .I a
92 .\"O and
93 .\"O .IR b ,
94 .\"O and places the sum in the
95 .\"O .I timeval
96 .\"O pointed to by
97 .\"O .IR res .
98 .\"O The result is normalized such that
99 .\"O .I res\->tv_usec
100 .\"O has a value in the range 0 to 999,999.
101 .BR timeradd ()
102 は、
103 .I a
104
105 .I b
106 の時刻値を加算し、その合計を
107 .I res
108 により参照される
109 .I timeval
110 構造体に格納する。結果は、
111 .I res\->tv_usec
112 の値が 0 から 999,999 の範囲に入るように正規化される。
113
114 .\"O .BR timersub ()
115 .\"O subtracts the time value in
116 .\"O .I b
117 .\"O from the time value in
118 .\"O .IR a ,
119 .\"O and places the result in the
120 .\"O .I timeval
121 .\"O pointed to by
122 .\"O .IR res .
123 .\"O The result is normalized such that
124 .\"O .I res\->tv_usec
125 .\"O has a value in the range 0 to 999,999.
126 .BR timersub ()
127 は、
128 .I a
129 の時刻値から
130 .I b
131 の時刻値を減算し、その結果を
132 .I res
133 により参照される
134 .I timeval
135 構造体に格納する。結果は、
136 .I res\->tv_usec
137 の値が 0 から 999,999 の範囲に入るように正規化される。
138
139 .\"O .BR timerclear ()
140 .\"O zeros out the
141 .\"O .I timeval
142 .\"O structure pointed to by
143 .\"O .IR tvp ,
144 .\"O so that it represents the Epoch: 1970-01-01 00:00:00 +0000 (UTC).
145 .BR timerclear ()
146
147 .I tvp
148 により参照される
149 .I timeval
150 構造体を 0 で埋める。
151 0 で埋められた
152 .I timeval
153 構造体は、時刻紀元 (Epoch; 1970-01-01 00:00:00 +0000 (UTC)) を表す。
154
155 .\"O .BR timerisset ()
156 .\"O returns true (nonzero) if either field of the
157 .\"O .I timeval
158 .\"O structure pointed to by
159 .\"O .I tvp
160 .\"O contains a nonzero value.
161 .BR timerisset ()
162 は、
163 .I tvp
164 により参照される
165 .I timeval
166 構造体のいずれか一方のフィールドに 0 以外の値が入っていれば、
167 真 (0 以外) を返す。
168
169 .\"O .BR timercmp ()
170 .\"O compares the timer values in
171 .\"O .I a
172 .\"O and
173 .\"O .I b
174 .\"O using the comparison operator
175 .\"O .IR CMP ,
176 .\"O and returns true (nonzero) or false (0) depending on
177 .\"O the result of the comparison.
178 .BR timercmp ()
179
180 .I a
181
182 .I b
183 の時刻値を比較演算子
184 .I CMP
185 を使って比較し、比較結果に基づき、真 (0 以外) か偽 (0) を返す。
186 .\"O Some systems (but not Linux/glibc),
187 .\"O have a broken
188 .\"O .BR timercmp ()
189 .\"O implementation,
190 .\"O .\" HP-UX, Tru64, Irix have a definition like:
191 .\"O .\"#define timercmp(tvp, uvp, cmp) \
192 .\"O .\"    ((tvp)->tv_sec cmp (uvp)->tv_sec || \
193 .\"O .\"    (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
194 .\"O in which
195 .\"O .I CMP
196 .\"O of
197 .\"O .IR >= ,
198 .\"O .IR <= ,
199 .\"O and
200 .\"O .I ==
201 .\"O do not work;
202 (Linux/glibc はそうではないが)
203 いくつかのシステムでは、
204 .BRr timercmp ()
205 の実装がおかしく、
206 .\" HP-UX, Tru64, Irix では以下のように定義されている。
207 .\"#define timercmp(tvp, uvp, cmp) \
208 .\"    ((tvp)->tv_sec cmp (uvp)->tv_sec || \
209 .\"    (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
210 .I CMP
211
212 .IR >= ,
213 .IR <= ,
214 .I ==
215 を指定すると正しく動作しない。
216 .\"O portable applications can instead use
217 移植性が必要なアプリケーションでは、
218 代わりに以下を使うこと。
219
220     !timercmp(..., <)
221     !timercmp(..., >)
222     !timercmp(..., !=)
223 .\"O .SH RETURN VALUE
224 .SH 返り値
225 .\"O .BR timerisset ()
226 .\"O and
227 .\"O .BR timercmp ()
228 .\"O return true (nonzero) or false (0).
229 .BR timerisset ()
230
231 .BR timercmp ()
232 は、真 (0 以外) か偽 (0) を返す。
233 .BR
234 .\"O .SH ERRORS
235 .SH エラー
236 .\"O No errors are defined.
237 エラーは定義されていない。
238 .\"O .SH CONFORMING TO
239 .SH 準拠
240 .\"O Not in POSIX.1-2001.
241 .\"O Present on most BSD derivatives.
242 POSIX.1-2001 にはない。
243 ほとんどの BSD 由来のシステムには存在する。
244 .\"O .SH "SEE ALSO"
245 .SH 関連項目
246 .BR gettimeofday (2),
247 .BR time (7)