📄 getitimer.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>getitimer</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_005_590"> </a>NAME</h4><blockquote>getitimer, setitimer - get or set value of interval timer</blockquote><h4><a name = "tag_000_005_591"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="systime.h.html">sys/time.h</a>>int getitimer(int <i>which</i>, struct itimerval *<i>value</i>);int setitimer(int <i>which</i>, const struct itimerval *<i>value</i>, struct itimerval *<i>ovalue</i>);</code></pre></blockquote><h4><a name = "tag_000_005_592"> </a>DESCRIPTION</h4><blockquote>The<i>getitimer()</i>function stores the current value of the timer specified by <i>which</i> intothe structure pointed to by <i>value</i>. The<i><a href="setitimer.html">setitimer()</a></i>function sets the timer specified by <i>which</i> to the valuespecified in the structure pointed to by <i>value</i>, and if <i>ovalue</i> isnot a null pointer, stores the previous value of the timer in the structurepointed to by <i>ovalue</i>.<p>A timer value is defined by the <b>itimerval</b> structure.If <i>it_value</i>is non-zero, it indicates the time to the next timer expiration. If<i>it_interval</i> is non-zero, it specifies a value to be used inreloading <i>it_value</i> when the timer expires. Setting <i>it_value</i>to 0 disables a timer, regardless of the value of <i>it_interval</i>.Setting <i>it_interval</i> to 0 disables a timer after itsnext expiration (assuming <i>it_value</i> is non-zero).<p>Implementations may place limitations on the granularity of timer values.For each interval timer, if the requested timer value requires a finergranularity than the implementation supports, the actual timer value will berounded up to the next supported value.<p>An XSI-conforming implementation provides each process with at least threeinterval timers, which are indicated by the <i>which</i> argument:<dl compact><dt>ITIMER_REAL<dd>Decrements in real time.A SIGALRM signal is delivered when this timerexpires.<dt>ITIMER_VIRTUAL<dd>Decrements in process virtual time. It runs only when the process isexecuting. A SIGVTALRM signal is delivered when it expires.<dt>ITIMER_PROF<dd>Decrements both in process virtual time andwhen the system is running on behalf of the process.It is designed to be used by interpreters in statisticallyprofiling the execution of interpreted programs.Each time the ITIMER_PROF timer expires, the SIGPROF signal is delivered.</dl><p>The interaction between<i><a href="setitimer.html">setitimer()</a></i>and any of<i><a href="alarm.html">alarm()</a></i>,<i><a href="sleep.html">sleep()</a></i>or<i><a href="usleep.html">usleep()</a></i>is unspecified.</blockquote><h4><a name = "tag_000_005_593"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>getitimer()</i>or<i><a href="setitimer.html">setitimer()</a></i>returns 0.Otherwise, -1 is returned and <i>errno</i> is set to indicate the error.</blockquote><h4><a name = "tag_000_005_594"> </a>ERRORS</h4><blockquote>The<i><a href="setitimer.html">setitimer()</a></i>function will fail if:<dl compact><dt>[EINVAL]<dd>The <i>value</i> argument is not in canonical form. (In canonical form, thenumber of microseconds is a non-negative integer less than 1,000,000 and thenumber of seconds is a non-negative integer.)</dl><p>The<i>getitimer()</i>and<i><a href="setitimer.html">setitimer()</a></i>functions may fail if:<dl compact><dt>[EINVAL]<dd>The <i>which</i> argument is not recognised.</dl></blockquote><h4><a name = "tag_000_005_595"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_596"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_597"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_598"> </a>SEE ALSO</h4><blockquote><i><a href="alarm.html">alarm()</a></i>,<i><a href="sleep.html">sleep()</a></i>,<i><a href="timer_gettime.html">timer_gettime()</a></i>,<i><a href="timer_settime.html">timer_settime()</a></i>,<i><a href="ualarm.html">ualarm()</a></i>,<i><a href="usleep.html">usleep()</a></i>,<i><a href="signal.h.html"><signal.h></a></i>,<i><a href="systime.h.html"><sys/time.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -