1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (c) 2003 Nick Clifford (zaf@nrc.co.nz), Jan 25, 2003
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl), Aug 24, 2003
.\"
.\" 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.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" 2003-08-23 Martin Schulze <joey@infodrom.org> improvements
.\" 2003-08-24 aeb, large parts rewritten
.\" 2004-08-06 Christoph Lameter <clameter@sgi.com>, SMP note
.\"
.\" Japanese Version Copyright (c) 2004-2005 Yuichi SATO
.\" all rights reserved.
.\" Translated Mon Jul 19 21:28:23 JST 2004
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\" Updated & Modified Mon Jan 10 07:35:05 JST 2005 by Yuichi SATO
.\"
.TH CLOCK_GETRES 2 2009-02-05 "" "Linux Programmer's Manual"
.SH ̾
clock_getres, clock_gettime, clock_settime \- åȻ֤δؿ
.SH
.B #include <time.h>
.sp
.BI "int clock_getres(clockid_t " clk_id ", struct timespec *" res );
.BI "int clock_gettime(clockid_t " clk_id ", struct timespec *" tp );
.BI "int clock_settime(clockid_t " clk_id ", const struct timespec *" tp );
.sp
\fI\-lrt\fP ȥ롣
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.ad l
.BR clock_getres (),
.BR clock_gettime (),
.BR clock_settime ():
_POSIX_C_SOURCE\ >=\ 199309L
.ad b
.SH
ؿ
.BR clock_getres ()
ꤵ줿å
.I clk_id
ʬǽ () õФ
.I res
NULL Ǥʤ硢ʬǽ
.I res
ǻؤ \fIstruct timespec\fP ˳Ǽ롣
åʬǽϼ˰¸
Υץˤäꤹ뤳ȤϤǤʤ
.BR clock_settime ()
ΰ
.I tp
ǻؤ֤ͤ
.I res
ܿǤʤ硢
.I res
ܿڤͤ롣
.PP
ؿ
.BR clock_gettime ()
.BR clock_settime ()
ϡꤵ줿å
.I clk_id
λ֤ޤꤹ롣
.PP
.I res
.I tp
.I timespec
¤ΤǤꡢ
.I <time.h>
ǰʲΤ褦˵ꤵƤ:
.sp
.in +4n
.nf
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
.fi
.in
.PP
.I clk_id
Υåμ̻ҤǤꡢΥåư롣
åϥƥΤŬѤ뤳ȤǤ
ξƤΥץ鸫뤳ȤǤ롣
ޤ 1 ĤΥץǤΤ֤¬ϡ
ץŬѤ뤳ȤǤ롣
.LP
ƤμˤƥƥΤΥꥢ륿९åݡȤ졢
.B CLOCK_REALTIME
Ǽ̤롣
֤ϵ (the Epoch) äȥʥäɽ롣
֤ѹ줿硢Ūʻֳִ֤Υޤϱƶʤ
ŪʻΥޤϱƶ롣
.LP
ˤĤΥåƤ뤫⤷ʤ
б֤᤹ͤˡȥޤؤαƶϡƤʤ
.LP
glibc Linux ͥκǿΥСǤϡ
ʲΤ褦ʽʬʥåݡȤƤ롣
.TP
.B CLOCK_REALTIME
ƥΤΥꥢ륿९å
ΥåꤹˤŬڤøɬפǤ롣
.TP
.B CLOCK_MONOTONIC
ĤγꤵƤʤᡢ
åΥȥ˥åꤷɽǤʤ
.TP
.BR CLOCK_MONOTONIC_RAW " (Linux 2.6.28 ʹ; Linux ͭ)"
.\" Added in commit 2d42244ae71d6c7b0884b5664cf2eda30fb2ae68, John Stultz
.B CLOCK_MONOTONIC
ƱͤNTP ˤĴαƶʤϡɥˤ
λؤΥǤ롣
.TP
.B CLOCK_PROCESS_CPUTIME_ID
CPU ˤʬǽΥץΥޡ
.TP
.B CLOCK_THREAD_CPUTIME_ID
åɸͭ CPU ९å
.SH ֤
.BR clock_gettime (),
.BR clock_settime (),
.BR clock_getres ()
0 ֤Ԥ \-1 ֤
(Ԥ硢
.I errno
Ŭڤꤵ)
.SH 顼
.TP
.B EFAULT
.I tp
ǽʥɥ쥹֤γؤ
.TP
.B EINVAL
ꤵ줿
.I clk_id
ΥƥǥݡȤƤʤ
.TP
.B EPERM
ؼ줿åꤹ븢¤
.BR clock_settime ()
ˤʤ
.SH
SUSv2, POSIX.1-2001.
.SH
δؿѲǽ POSIX ƥǤϡ\fI<unistd.h>\fP ˤƥܥ
.B _POSIX_TIMERS
0 礭ͤƤ롣
ܥ
.BR _POSIX_MONOTONIC_CLOCK ,
.BR _POSIX_CPUTIME ,
.B _POSIX_THREAD_CPUTIME
.BR CLOCK_MONOTONIC ,
.BR CLOCK_PROCESS_CPUTIME_ID ,
.B CLOCK_THREAD_CPUTIME_ID
ѲǽʤȤ
.RB ( sysconf (3)
⻲Ȥ뤳ȡ)
.SH
.SS "SMP ƥˤĤƤ"
.B CLOCK_PROCESS_CPUTIME_ID
.B CLOCK_THREAD_CPUTIME_ID
åϡCPU Υ
(i386 TSCItanium AR.ITC) ѤƼ¸Ƥ롣
Υ쥸 CPU ֤ǰۤʤǽꡢ
ץ¾ CPU ˰ư줿硢
̤ȤƤΥå\fBη\fR
(bogus results) ֤⤷ʤ
.PP
SMP ƥγ CPU ̡Υåľ硢
ޥ쥸֤ߴطˡϤʤ
ϳ CPU ̯˰ۤʤȿư뤿Ǥ롣
줬¤ξ (: CPU ̡Υåľ)
.I clock_getcpuclockid(0)
.B ENOENT
֤ơξɽ
2 ĤΥåϡץ CPU αޤäƤ뤳Ȥ
ݾڤǤˤΤͭǤ롣
.PP
SMP ƥγƥץåƱ˵ưǤϤʤΤǡ
ƥޥ쥸̾Ϥ륪եåȤưƤ롣
եåȤ֡Ȼ¤륳ɤޤޤ륢ƥ⤢롣
ΥɤեåȤΤĴ뤳ȤݾڤǤʤ
glibc (Linux ͥȤϰۤʤ) եåȤΥɤʤ
̾ϤΥեåȤΤǡ¿ξǤαƶ̵Ǥ롣
.SH Х
POSIX.1-2001 Ǥϡå
.B CLOCK_PROCESS_CPUTIME_ID
.B CLOCK_THREAD_CPUTIME_ID
.BR clock_settime ()
ˤǽˤ٤ȤƤ롣
ΥåϸߤΤȤ
.\" Linux 2.6.28
ʤäƤʤ
.\" FIXME . Track the following bug report
.\" http://bugzilla.kernel.org/show_bug.cgi?id=11972
.SH Ϣ
.BR date (1),
.BR adjtimex (2),
.BR gettimeofday (2),
.BR settimeofday (2),
.BR time (2),
.BR clock_getcpuclockid (3),
.BR ctime (3),
.BR ftime (3),
.BR pthread_getcpuclockid (3),
.BR sysconf (3),
.BR time (7)
|