📄 timerlib.html
字号:
Both values are copied to the <i>value</i> structure.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK), or -1 (ERROR) if <i>timerid</i> is invalid.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b><hr><a name="timer_getoverrun"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>timer_getoverrun( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>timer_getoverrun( )</strong> - return the timer expiration overrun (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int timer_getoverrun ( timer_t timerid /* timer ID */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the timer expiration overrun count for <i>timerid</i>,when called from a timer expiration signal catcher. The overrun count isthe number of extra timer expirations that have occurred, up to theimplementation-defined maximum <b>_POSIX_DELAYTIMER_MAX</b>. If the count isgreater than the maximum, it returns the maximum.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The number of overruns, or <b>_POSIX_DELAYTIMER_MAX</b> if the count equals or isgreater than <b>_POSIX_DELAYTIMER_MAX</b>, or -1 (ERROR) if <i>timerid</i> is invalid.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL, ENOSYS</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b><hr><a name="timer_settime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>timer_settime( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>timer_settime( )</strong> - set the time until the next expiration and arm timer (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int timer_settime ( timer_t timerid, /* timer ID */ int flags, /* absolute or relative */ const struct itimerspec * value, /* time to be set */ struct itimerspec * ovalue /* previous time set (NULL=no result) */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the next expiration of the timer, using the <b>.it_value</b>of <i>value</i>, thus arming the timer. If the timer is already armed, thiscall resets the time until the next expiration. If <b>.it_value</b> is zero,the timer is disarmed.<p>If <i>flags</i> is not equal to <b>TIMER_ABSTIME</b>, the interval is relative to thecurrent time, the interval being the <b>.it_value</b> of the <i>value</i> parameter.If <i>flags</i> is equal to <b>TIMER_ABSTIME</b>, the expiration is set tothe difference between the absolute time of <b>.it_value</b> and the currentvalue of the clock associated with <i>timerid</i>. If the time has alreadypassed, then the timer expiration notification is made immediately.The task that sets the timer receives the signal; in other words, the taskIdis noted. If a timer is set by an ISR, the signal is delivered to thetask that created the timer.<p>The reload value of the timer is set to the value specified bythe <b>.it_interval</b> field of <i>value</i>. When a timer isarmed with a nonzero <b>.it_interval</b> a periodic timer is set up.<p>Time values that are between two consecutive non-negative integermultiples of the resolution of the specified timer are rounded up tothe larger multiple of the resolution.<p>If <i>ovalue</i> is non-NULL, the routine stores a value representing theprevious amount of time before the timer would have expired. Or if thetimer is disarmed, the routine stores zero, together with the previoustimer reload value. The <i>ovalue</i> parameter is the same value as that returned by <b><a href="./timerLib.html#timer_gettime">timer_gettime</a>( )</b> and is subject to the timer resolution.<p></blockquote><h4>WARNING</h4><blockquote><p>If <b><a href="./clockLib.html#clock_settime">clock_settime</a>( )</b> is called to reset the absolute clock time after a timerhas been set with <b><a href="./timerLib.html#timer_settime">timer_settime</a>( )</b>, and if <i>flags</i> is equal to <b>TIMER_ABSTIME</b>, then the timer will behave unpredictably. If you must reset the absoluteclock time after setting a timer, do not use <i>flags</i> equal to <b>TIMER_ABSTIME</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>0 (OK), or -1 (ERROR) if <i>timerid</i> is invalid, the number of nanoseconds specified by <i>value</i> is less than 0 or greater than or equal to 1,000,000,000, or the time specified by <i>value</i> exceeds the maximum allowed by the timer.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b><hr><a name="nanosleep"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>nanosleep( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>nanosleep( )</strong> - suspend the current task until the time interval elapses (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int nanosleep ( const struct timespec * rqtp, /* time to delay */ struct timespec * rmtp /* premature wakeup (NULL=no result) */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine suspends the current task for a specified time <i>rqtp</i>or until a signal or event notification is made.<p>The suspension may be longer than requested due to the rounding up of therequest to the timer's resolution or to other scheduling activities (e.g.,a higher priority task intervenes).<p>The <b>timespec</b> structure is defined as follows:<p><pre>struct timespec { /* interval = tv_sec*10**9 + tv_nsec */ time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds (0 - 1,000,000,000) */ };</pre>If <i>rmtp</i> is non-NULL, the <b>timespec</b> structure is updated to contain theamount of time remaining. If <i>rmtp</i> is NULL, the remaining time is notreturned. The <i>rqtp</i> parameter is greater than 0 or less than or equal to1,000,000,000.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>0 (OK), or -1 (ERROR) if the routine is interrupted by a signal or an asynchronous event notification, or <i>rqtp</i> is invalid.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL, EINTR<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b>, <b><a href="./timerLib.html#sleep">sleep</a>( )</b>, <b><a href="./taskLib.html#taskDelay">taskDelay</a>( )</b><hr><a name="sleep"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>sleep( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>sleep( )</strong> - delay for a specified amount of time</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>unsigned int sleep ( unsigned int secs )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine causes the calling task to be blocked for <i>secs</i> seconds.<p>The time the task is blocked for may be longer than requested due to therounding up of the request to the timer's resolution or to other schedulingactivities (e.g., a higher priority task intervenes).<p></blockquote><h4>RETURNS</h4><blockquote><p>Zero if the requested time has elapsed, or the number of secondsremaining if it was interrupted.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL, EINTR<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b>, <b><a href="./timerLib.html#nanosleep">nanosleep</a>( )</b>, <b><a href="./taskLib.html#taskDelay">taskDelay</a>( )</b><hr><a name="alarm"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>alarm( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>alarm( )</strong> - set an alarm clock for delivery of a signal</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>unsigned int alarm ( unsigned int secs )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine arranges for a <b>SIGALRM</b> signal to be delivered to thecalling task after <i>secs</i> seconds.<p>If <i>secs</i> is zero, no new alarm is scheduled. In all cases, any previouslyset alarm is cancelled.<p></blockquote><h4>RETURNS</h4><blockquote><p>Time remaining until a previously scheduled alarm was due to bedelivered, zero if there was no previous alarm, or ERROR in case of anerror.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./timerLib.html#top">timerLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -