OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / release / man2 / clock_getres.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 2003 Nick Clifford (zaf@nrc.co.nz), Jan 25, 2003
4 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl), Aug 24, 2003
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" 2003-08-23 Martin Schulze <joey@infodrom.org> improvements
27 .\" 2003-08-24 aeb, large parts rewritten
28 .\" 2004-08-06 Christoph Lameter <clameter@sgi.com>, SMP note
29 .\"
30 .\" FIXME: Linux 2.6.39 adds CLOCK_BOOTTIME
31 .\"
32 .\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO
33 .\"         all rights reserved.
34 .\" Translated 2004-07-19, Yuichi SATO <ysato444@yahoo.co.jp>
35 .\" Updated & Modified 2005-01-10, Yuichi SATO
36 .\" Updated 2010-04-11, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
37 .\"
38 .TH CLOCK_GETRES 2 2010-02-03 "" "Linux Programmer's Manual"
39 .SH Ì¾Á°
40 clock_getres, clock_gettime, clock_settime \- ¥¯¥í¥Ã¥¯¤È»þ´Ö¤Î´Ø¿ô
41 .SH ½ñ¼°
42 .B #include <time.h>
43 .sp
44 .BI "int clock_getres(clockid_t " clk_id ", struct timespec *" res );
45
46 .BI "int clock_gettime(clockid_t " clk_id ", struct timespec *" tp );
47
48 .BI "int clock_settime(clockid_t " clk_id ", const struct timespec *" tp );
49 .sp
50 \fI\-lrt\fP ¤È¥ê¥ó¥¯¤¹¤ë¡£
51 .sp
52 .in -4n
53 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
54 .RB ( feature_test_macros (7)
55 »²¾È):
56 .in
57 .sp
58 .ad l
59 .BR clock_getres (),
60 .BR clock_gettime (),
61 .BR clock_settime ():
62 .RS
63 _POSIX_C_SOURCE\ >=\ 199309L
64 .RE
65 .ad b
66 .SH ÀâÌÀ
67 ´Ø¿ô
68 .BR clock_getres ()
69 ¤Ï
70 »ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯
71 .I clk_id
72 ¤Îʬ²òǽ (ÀºÅÙ) ¤òõ¤·½Ð¤¹¡£
73 .I res
74 ¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢¤½¤Îʬ²òǽ¤ò
75 .I res
76 ¤Ç»Ø¤µ¤ì¤ë \fIstruct timespec\fP ¤Ë³ÊǼ¤¹¤ë¡£
77 ¥¯¥í¥Ã¥¯¤Îʬ²òǽ¤Ï¼ÂÁõ¤Ë°Í¸¤·¡¢
78 ÆÃÄê¤Î¥×¥í¥»¥¹¤Ë¤è¤Ã¤ÆÀßÄꤹ¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
79 .BR clock_settime ()
80 ¤Î°ú¤­¿ô
81 .I tp
82 ¤Ç»Ø¤µ¤ì¤ë»þ´Ö¤ÎÃͤ¬
83 .I res
84 ¤ÎÇÜ¿ô¤Ç¤Ê¤¤¾ì¹ç¡¢
85 .I res
86 ¤ÎÇÜ¿ô¤ËÀÚ¤êµÍ¤á¤é¤ì¤ë¡£
87 .PP
88 ´Ø¿ô
89 .BR clock_gettime ()
90 ¤È
91 .BR clock_settime ()
92 ¤Ï¡¢»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯
93 .I clk_id
94 ¤Î»þ´Ö¤ò¼èÆÀ¤Þ¤¿¤ÏÀßÄꤹ¤ë¡£
95 .PP
96 .I res
97 ¤È
98 .I tp
99 °ú¤­¿ô¤Ï
100 .I timespec
101 ¹½Â¤ÂΤǤ¢¤ê¡¢
102 .I <time.h>
103 ¤Ç°Ê²¼¤Î¤è¤¦¤Ëµ¬Äꤵ¤ì¤Æ¤¤¤ë:
104 .sp
105 .in +4n
106 .nf
107 struct timespec {
108     time_t   tv_sec;        /* seconds */
109     long     tv_nsec;       /* nanoseconds */
110 };
111 .fi
112 .in
113 .PP
114 .I clk_id
115 °ú¤­¿ô¤ÏÆÃÄê¤Î¥¯¥í¥Ã¥¯¤Î¼±Ê̻ҤǤ¢¤ê¡¢¤½¤Î¥¯¥í¥Ã¥¯¤ÇÆ°ºî¤¹¤ë¡£
116 ¥¯¥í¥Ã¥¯¤Ï¥·¥¹¥Æ¥àÁ´ÂΤËŬÍѤ¹¤ë¤³¤È¤â¤Ç¤­¡¢
117 ¤½¤Î¾ì¹ç¤ÏÁ´¤Æ¤Î¥×¥í¥»¥¹¤«¤é¸«¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
118 ¤Þ¤¿ 1 ¤Ä¤Î¥×¥í¥»¥¹Æâ¤Ç¤Î¤ß»þ´Ö¤ò·×¬¤¹¤ë¾ì¹ç¤Ï¡¢
119 ¥×¥í¥»¥¹Ëè¤ËŬÍѤ¹¤ë¤³¤È¤â¤Ç¤­¤ë¡£
120 .LP
121 Á´¤Æ¤Î¼ÂÁõ¤Ë¤ª¤¤¤Æ¥·¥¹¥Æ¥àÁ´ÂΤΥꥢ¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯¤¬¥µ¥Ý¡¼¥È¤µ¤ì¡¢
122 .B CLOCK_REALTIME
123 ¤Ç¼±Ê̤µ¤ì¤ë¡£
124 »þ´Ö¤Ïµª¸µ (the Epoch) ¤«¤é¤ÎÉäȥʥÎÉäÇɽ¤µ¤ì¤ë¡£
125 »þ´Ö¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¡¢ÁêÂÐŪ¤Ê»þ´Ö´Ö³Ö¤Î¥¿¥¤¥Þ¤Ï±Æ¶Á¤ò¼õ¤±¤Ê¤¤¤¬¡¢
126 ÀäÂÐŪ¤Ê»þÅÀ¤Î¥¿¥¤¥Þ¤Ï±Æ¶Á¤ò¼õ¤±¤ë¡£
127 .LP
128 ¤µ¤é¤Ë¤¤¤¯¤Ä¤«¤Î¥¯¥í¥Ã¥¯¤¬¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
129 Âбþ¤¹¤ë»þ´Ö¤ÎÃͤò²ò¼á¤¹¤ëÊýË¡¤È¥¿¥¤¥Þ¤Ø¤Î±Æ¶Á¤Ï¡¢Äê¤á¤é¤ì¤Æ¤¤¤Ê¤¤¡£
130 .LP
131 glibc ¤È Linux ¥«¡¼¥Í¥ë¤ÎºÇ¿·¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢
132 °Ê²¼¤Î¤è¤¦¤Ê½½Ê¬¤Ê¥¯¥í¥Ã¥¯¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
133 .TP
134 .B CLOCK_REALTIME
135 ¥·¥¹¥Æ¥àÁ´ÂΤΥꥢ¥ë¥¿¥¤¥à¥¯¥í¥Ã¥¯¡£
136 ¤³¤Î¥¯¥í¥Ã¥¯¤òÀßÄꤹ¤ë¤Ë¤ÏŬÀÚ¤ÊÆø¢¤¬É¬ÍפǤ¢¤ë¡£
137 .TP
138 .B CLOCK_MONOTONIC
139 ¤¤¤¯¤Ä¤«¤Î³«»ÏÅÀ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤¿¤á¡¢
140 ¥¯¥í¥Ã¥¯¤¬¥â¥Î¥È¥Ë¥Ã¥¯¥¿¥¤¥à¤òÀßÄꤷ¤¿¤êɽ¸½¤·¤¿¤ê¤Ç¤­¤Ê¤¤¡£
141 .TP
142 .BR CLOCK_MONOTONIC_RAW " (Linux 2.6.28 °Ê¹ß; Linux ÆÃÍ­)"
143 .\" Added in commit 2d42244ae71d6c7b0884b5664cf2eda30fb2ae68, John Stultz
144 .B CLOCK_MONOTONIC
145 ¤ÈƱÍͤÀ¤¬¡¢NTP ¤Ë¤è¤ëÄ´À°¤Î±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡¢¥Ï¡¼¥É¥¦¥§¥¢¤Ë¤è¤ë
146 À¸¤Î»þ¹ï¤Ø¤Î¥¢¥¯¥»¥¹¤¬¤Ç¤­¤ë¡£
147 .TP
148 .B CLOCK_PROCESS_CPUTIME_ID
149 CPU ¤Ë¤è¤ë¹âʬ²òǽ¤Î¥×¥í¥»¥¹Ëè¤Î¥¿¥¤¥Þ¡£
150 .TP
151 .B CLOCK_THREAD_CPUTIME_ID
152 ¥¹¥ì¥Ã¥É¸ÇÍ­¤Î CPU ¥¿¥¤¥à¥¯¥í¥Ã¥¯¡£
153 .SH ÊÖ¤êÃÍ
154 .BR clock_gettime (),
155 .BR clock_settime (),
156 .BR clock_getres ()
157 ¤ÏÀ®¸ù¤·¤¿¾ì¹ç¤Ë 0 ¤òÊÖ¤·¡¢¼ºÇÔ¤·¤¿¾ì¹ç¤Ë \-1 ¤òÊÖ¤¹
158 (¼ºÇÔ¤·¤¿¾ì¹ç¡¢
159 .I errno
160 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë)¡£
161 .SH ¥¨¥é¡¼
162 .TP
163 .B EFAULT
164 .I tp
165 ¤¬¥¢¥¯¥»¥¹²Äǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö¤Î³°¤ò»Ø¤·¤¿¡£
166 .TP
167 .B EINVAL
168 .\" Linux also gives this error on attempts to set CLOCK_PROCESS_CPUTIME_ID
169 .\" and CLOCK_THREAD_CPUTIME_ID, when probably the proper error should be
170 .\" EPERM.
171 »ØÄꤵ¤ì¤¿
172 .I clk_id
173 ¤¬¤³¤Î¥·¥¹¥Æ¥à¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
174 .TP
175 .B EPERM
176 »Ø¼¨¤µ¤ì¤¿¥¯¥í¥Ã¥¯¤òÀßÄꤹ¤ë¸¢¸Â¤¬
177 .BR clock_settime ()
178 ¤Ë¤Ê¤¤¡£
179 .SH ½àµò
180 SUSv2, POSIX.1-2001.
181 .SH ²ÄÍÑÀ­
182 ¤³¤ì¤é¤Î´Ø¿ô¤¬ÍøÍѲÄǽ¤Ê POSIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢\fI<unistd.h>\fP ¤Ë¤ª¤¤¤Æ¥·¥ó¥Ü¥ë
183 .B _POSIX_TIMERS
184 ¤¬ 0 ¤è¤êÂ礭¤¤ÃͤËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
185 ¥·¥ó¥Ü¥ë
186 .BR _POSIX_MONOTONIC_CLOCK ,
187 .BR _POSIX_CPUTIME ,
188 .B _POSIX_THREAD_CPUTIME
189 ¤Ï
190 .BR CLOCK_MONOTONIC ,
191 .BR CLOCK_PROCESS_CPUTIME_ID ,
192 .B CLOCK_THREAD_CPUTIME_ID
193 ¤¬ÍøÍѲÄǽ¤Ê¤³¤È¤ò¼¨¤¹¡£
194 .RB ( sysconf (3)
195 ¤â»²¾È¤¹¤ë¤³¤È¡£)
196 .SH Ãí°Õ
197 .SS "SMP ¥·¥¹¥Æ¥à¤Ë¤Ä¤¤¤Æ¤ÎÃí°Õ"
198 .B CLOCK_PROCESS_CPUTIME_ID
199 ¤È
200 .B CLOCK_THREAD_CPUTIME_ID
201 ¥¯¥í¥Ã¥¯¤Ï¡¢CPU ¤«¤é¤Î¥¿¥¤¥Þ
202 (i386 ¾å¤Î TSC¡¢Itanium ¾å¤Î AR.ITC) ¤òÍѤ¤¤Æ¼Â¸½¤µ¤ì¤Æ¤¤¤ë¡£
203 ¤³¤ì¤é¤Î¥ì¥¸¥¹¥¿¤Ï CPU ´Ö¤Ç°Û¤Ê¤ë²ÄǽÀ­¤¬¤¢¤ê¡¢
204 ¥×¥í¥»¥¹¤¬Â¾¤Î CPU ¤Ë°ÜÆ°¤µ¤»¤é¤ì¤¿¾ì¹ç¡¢
205 ·ë²Ì¤È¤·¤Æ¤³¤ì¤é¤Î¥¯¥í¥Ã¥¯¤¬\fBµ¶¤Î·ë²Ì\fR
206 (bogus results) ¤òÊÖ¤¹¤«¤â¤·¤ì¤Ê¤¤¡£
207 .PP
208 SMP ¥·¥¹¥Æ¥à¤Î³Æ CPU ¤¬ÊÌ¡¹¤Î¥¯¥í¥Ã¥¯¸»¤ò»ý¤Ä¾ì¹ç¡¢
209 ¥¿¥¤¥Þ¥ì¥¸¥¹¥¿´Ö¤ÎÁê¸ß´Ø·¸¤ò´ÉÍý¤¹¤ëÊýË¡¤Ï¤Ê¤¤¡£
210 ¤³¤ì¤Ï³Æ CPU ¤¬Èù̯¤Ë°Û¤Ê¤ë¼þÇÈ¿ô¤ÇÆ°ºî¤¹¤ë¤¿¤á¤Ç¤¢¤ë¡£
211 ¤³¤ì¤¬¿¿¼Â¤Î¾ì¹ç (ÌõÃð: ³Æ CPU ¤¬ÊÌ¡¹¤Î¥¯¥í¥Ã¥¯¸»¤ò»ý¤Ä¾ì¹ç)¡¢
212 .I clock_getcpuclockid(0)
213 ¤Ï
214 .B ENOENT
215 ¤òÊÖ¤·¤Æ¡¢¤½¤Î¾õ¶·¤òɽ¤¹¡£
216 2 ¤Ä¤Î¥¯¥í¥Ã¥¯¤Ï¡¢¥×¥í¥»¥¹¤¬ÆÃÄê¤Î CPU ¾å¤Ëα¤Þ¤Ã¤Æ¤¤¤ë¤³¤È¤¬
217 ÊݾڤǤ­¤ë¾ì¹ç¤Ë¤Î¤ßÍ­¸ú¤Ç¤¢¤ë¡£
218 .PP
219 SMP ¥·¥¹¥Æ¥à¤Î³Æ¥×¥í¥»¥Ã¥µ¤ÏÁ´¤¯Æ±¤¸»þ¹ï¤Ëµ¯Æ°¤¹¤ëÌõ¤Ç¤Ï¤Ê¤¤¤Î¤Ç¡¢
220 ³Æ¥¿¥¤¥Þ¥ì¥¸¥¹¥¿¤ÏÄ̾ï¤Ï¤¢¤ë¥ª¥Õ¥»¥Ã¥È¤ÇÆ°ºî¤·¤Æ¤¤¤ë¡£
221 ¥ª¥Õ¥»¥Ã¥È¤ò¥Ö¡¼¥È»þ¤ËÀ©¸Â¤¹¤ë¥³¡¼¥É¤¬´Þ¤Þ¤ì¤ë¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤â¤¢¤ë¡£
222 ¤·¤«¤·¡¢¤³¤Î¥³¡¼¥É¤¬¥ª¥Õ¥»¥Ã¥È¤òÀµ³Î¤ËÄ´À°¤¹¤ë¤³¤È¤ÏÊݾڤǤ­¤Ê¤¤¡£
223 glibc ¤Ï (Linux ¥«¡¼¥Í¥ë¤È¤Ï°Û¤Ê¤ê) ¥ª¥Õ¥»¥Ã¥È¤ò°·¤¦¤¿¤á¤Î¥³¡¼¥É¤òÄ󶡤·¤Ê¤¤¡£
224 Ä̾ï¤Ï¤³¤ì¤é¤Î¥ª¥Õ¥»¥Ã¥È¤¬¾®¤µ¤¤¤Î¤Ç¡¢Â¿¤¯¤Î¾ì¹ç¤Ç¤½¤Î±Æ¶Á¤Ï̵»ë¤Ç¤­¤ë¡£
225 .SH ¥Ð¥°
226 POSIX.1-2001 ¤Ç¤Ï¡¢
227 ¡ÖŬÀÚ¤ÊÆø¢ (appropriate privileges)¡×¤ò»ý¤Ã¤¿¥×¥í¥»¥¹¤Ï¡¢
228 .BR clock_settime ()
229 ¤ò»È¤Ã¤Æ¡¢¥¯¥í¥Ã¥¯
230 .B CLOCK_PROCESS_CPUTIME_ID
231 ¤È
232 .B CLOCK_THREAD_CPUTIME_ID
233 ¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤­¤ë¤È¤µ¤ì¤Æ¤¤¤ë¡£
234 Linux ¤Ç¤Ï¡¢¤³¤ì¤é¤Î¥¯¥í¥Ã¥¯¤ÏÀßÄê²Äǽ¤Ç¤Ï¤Ê¤¤
235 (¤¹¤Ê¤ï¤Á¡¢¤É¤Î¥×¥í¥»¥¹¤â¡ÖŬÀÚ¤ÊÆø¢¡×¤ò»ý¤¿¤Ê¤¤)¡£
236 .\" See http://bugzilla.kernel.org/show_bug.cgi?id=11972
237 .SH ´ØÏ¢¹àÌÜ
238 .BR date (1),
239 .BR adjtimex (2),
240 .BR gettimeofday (2),
241 .BR settimeofday (2),
242 .BR time (2),
243 .BR clock_getcpuclockid (3),
244 .BR ctime (3),
245 .BR ftime (3),
246 .BR pthread_getcpuclockid (3),
247 .BR sysconf (3),
248 .BR time (7)