📄 clocklib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/clockLib.html - generated by refgen from clockLib.c --> <title> clockLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference : OS Libraries</i></a></p></blockquote><h1>clockLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>clockLib</strong> - clock library (POSIX) </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./clockLib.html#clock_getres">clock_getres</a>( )</b> - get the clock resolution (POSIX)<br><b><a href="./clockLib.html#clock_setres">clock_setres</a>( )</b> - set the clock resolution<br><b><a href="./clockLib.html#clock_gettime">clock_gettime</a>( )</b> - get the current time of the clock (POSIX)<br><b><a href="./clockLib.html#clock_settime">clock_settime</a>( )</b> - set the clock to a specified time (POSIX)<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides a clock interface, as defined in the IEEE standard,POSIX 1003.1b.<p>A clock is a software construct that keeps time in seconds andnanoseconds. The clock has a simple interface with three routines:<b><a href="./clockLib.html#clock_settime">clock_settime</a>( )</b>, <b><a href="./clockLib.html#clock_gettime">clock_gettime</a>( )</b>, and <b><a href="./clockLib.html#clock_getres">clock_getres</a>( )</b>. The non-POSIX routine<b><a href="./clockLib.html#clock_setres">clock_setres</a>( )</b> that was provided so that <b><a href="./clockLib.html#top">clockLib</a></b> could be informed if therewere changes in the system clock rate is no longer necessary. This routineis still present for backward compatibility, but does nothing.<p>Times used in these routines are stored in the timespec structure:<pre>struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds (0 -1,000,000,000) */ };</pre></blockquote><h4>IMPLEMENTATION</h4><blockquote><p>Only one <i>clock_id</i> is supported, the required <b>CLOCK_REALTIME</b>.Conceivably, additional "virtual" clocks could be supported, or supportfor additional auxiliary clock hardware (if available) could be added.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>timers.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p>IEEE <i>VxWorks Programmer's Guide: Basic OS, </i>POSIX 1003.1b documentation<p><hr><a name="clock_getres"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>clock_getres( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>clock_getres( )</strong> - get the clock resolution (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int clock_getres ( clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ struct timespec * res /* where to store resolution */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the clock resolution, in nanoseconds, based on therate returned by <b><a href="./sysLib.html#sysClkRateGet">sysClkRateGet</a>( )</b>. If <i>res</i> is non-NULL, the resolution isstored in the location pointed to.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>0 (OK), or -1 (ERROR) if <i>clock_id</i> is invalid.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./clockLib.html#top">clockLib</a></b>, <b><a href="./clockLib.html#clock_settime">clock_settime</a>( )</b>, <b><a href="./sysLib.html#sysClkRateGet">sysClkRateGet</a>( )</b>, <b><a href="./clockLib.html#clock_setres">clock_setres</a>( )</b><hr><a name="clock_setres"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>clock_setres( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>clock_setres( )</strong> - set the clock resolution</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int clock_setres ( clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ struct timespec * res /* resolution to be set */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine is obsolete. It will always return OK.<p></blockquote><h4>NOTE</h4><blockquote><p>Non-POSIX.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK always.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./clockLib.html#top">clockLib</a></b>, <b><a href="./clockLib.html#clock_getres">clock_getres</a>( )</b>, <b><a href="./sysLib.html#sysClkRateSet">sysClkRateSet</a>( )</b><hr><a name="clock_gettime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>clock_gettime( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>clock_gettime( )</strong> - get the current time of the clock (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int clock_gettime ( clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ struct timespec * tp /* where to store current time */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine gets the current value <i>tp</i> for the clock.<p></blockquote><h4>RETURNS</h4><blockquote><p>0 (OK), or -1 (ERROR) if <i>clock_id</i> is invalid or <i>tp</i> is NULL.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL, EFAULT</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./clockLib.html#top">clockLib</a></b><hr><a name="clock_settime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>clock_settime( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>clock_settime( )</strong> - set the clock to a specified time (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int clock_settime ( clockid_t clock_id, /* clock ID (always CLOCK_REALTIME) */ const struct timespec * tp /* time to set */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the clock to the value <i>tp</i>, which should be a multipleof the clock resolution. If <i>tp</i> is not a multiple of the resolution, itis truncated to the next smallest multiple of the resolution.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>0 (OK), or -1 (ERROR) if <i>clock_id</i> is invalid, <i>tp</i> is outside the supported range, or the <i>tp</i> nanosecond value is less than 0 or equal to or greater than1,000,000,000.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./clockLib.html#top">clockLib</a></b>, <b><a href="./clockLib.html#clock_getres">clock_getres</a>( )</b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -