📄 sntpclib.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/sntpcLib.html - generated by refgen from sntpcLib.c --> <title> sntpcLib </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>sntpcLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>sntpcLib</strong> - Simple Network Time Protocol (SNTP) client library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./sntpcLib.html#sntpcTimeGet">sntpcTimeGet</a>( )</b> - retrieve the current time from a remote source<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library implements the client side of the Simple Network Time Protocol (SNTP), a protocol that allows a system to maintain the accuracy of its internal clock based on time values reported by one or more remote sources. The library is included in the VxWorks image if <b>INCLUDE_SNTPC</b> is defined at the time the image is built.<p></blockquote><h4>USER INTERFACE</h4><blockquote><p>The <b><a href="./sntpcLib.html#sntpcTimeGet">sntpcTimeGet</a>( )</b> routine retrieves the time reported by a remote source andconverts that value for POSIX-compliant clocks. The routine will either send a request and extract the time from the reply, or it will wait until a message isreceived from an SNTP/NTP server executing in broadcast mode.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>sntpcLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./clockLib.html#top">clockLib</a></b>, RFC 1769<hr><a name="sntpcTimeGet"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>sntpcTimeGet( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>sntpcTimeGet( )</strong> - retrieve the current time from a remote source</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS sntpcTimeGet ( char * pServerAddr, /* server IP address or hostname */ u_int timeout, /* timeout interval in ticks */ struct timespec * pCurrTime /* storage for retrieved time value */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine stores the current time as reported by an SNTP/NTP server inthe location indicated by <i>pCurrTime</i>. The reported time is first convertedto the elapsed time since January 1, 1970, 00:00, GMT, which is the base valueused by UNIX systems. If <i>pServerAddr</i> is NULL, the routine listens for messages sent by an SNTP/NTP server in broadcast mode. Otherwise, thisroutine sends a request to the specified SNTP/NTP server and extracts thereported time from the reply. In either case, an error is returned if no message is received within the interval specified by <i>timeout</i>. Typically, SNTP/NTP servers operating in broadcast mode send update messages every 64 to 1024 seconds. An infinite timeout value is specified by <b>WAIT_FOREVER</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>OK, or ERROR if unsuccessful.<p></blockquote><h4>ERRNO</h4><blockquote><p><p> <b>S_sntpcLib_INVALID_PARAMETER</b>, <b>S_sntpcLib_INVALID_ADDRESS</b>, <b>S_sntpcLib_TIMEOUT</b>,<br> <b>S_sntpcLib_SERVER_UNSYNC</b>, <b>S_sntpcLib_VERSION_UNSUPPORTED</b></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./sntpcLib.html#top">sntpcLib</a></b></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -