亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sntpclib.c

?? vxworks的完整的源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* sntpcLib.c - Simple Network Time Protocol (SNTP) client library *//* Copyright 1984-2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history --------------------01k,07jan02,vvv  doc: added errnos for sntpcTimeGet and sntpcFetch (SPR #71557)01j,16mar99,spm  doc: removed references to configAll.h (SPR #25663)01e,14dec97,jdi  doc: cleanup.01d,10dec97,kbw  making man page changes01c,27aug97,spm  corrections for man page generation01b,15jul97,spm  code cleanup, documentation, and integration; entered in                 source code control01a,24may97,kyc  written*//* DESCRIPTIONThis 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 INCLUDE_SNTPC is defined at the time the image is built.USER INTERFACEThe sntpcTimeGet() 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.INCLUDE FILES: sntpcLib.hSEE ALSO: clockLib, RFC 1769*//* includes */#include "vxWorks.h"#include "sysLib.h"#include "ioLib.h"#include "inetLib.h"#include "hostLib.h"#include "sockLib.h"#include "errnoLib.h"#include "sntpcLib.h"/* globals */u_short sntpcPort;/* forward declarations */LOCAL STATUS sntpcListen (u_int, struct timespec *);LOCAL STATUS sntpcFetch (struct in_addr *, u_int, struct timespec *);/********************************************************************************* sntpcInit - set up the SNTP client** This routine is called to link the SNTP client module into the VxWorks* image. It assigns the UDP source and destination port according to the* corresponding SNTP_PORT setting.* * RETURNS: OK, always.** ERRNO: N/A** NOMANUAL*/STATUS sntpcInit    (    u_short 	port 	/* UDP source/destination port */    )    {    sntpcPort = htons (port);    return (OK);    }/********************************************************************************* sntpcFractionToNsec - convert time from the NTP format to POSIX time format** This routine converts the fractional part of the NTP timestamp format to a * value in nanoseconds compliant with the POSIX clock.  While the NTP time * format provides a precision of about 200 pico-seconds, rounding error in the * conversion routine reduces the precision to tenths of a micro-second.* * RETURNS: Value for struct timespec corresponding to NTP fractional part** ERRNO:   N/A** INTERNAL** Floating-point calculations can't be used because some boards (notably* the SPARC architectures) disable software floating point by default to * speed up context switching. These boards abort with an exception when* floating point operations are encountered.** NOMANUAL*/LOCAL ULONG sntpcFractionToNsec    (    ULONG sntpFraction      /* base 2 fractional part of the NTP timestamp */    )    {    ULONG factor = 0x8AC72305; /* Conversion factor from base 2 to base 10 */    ULONG divisor = 10;        /* Initial exponent for mantissa. */    ULONG mask = 1000000000;   /* Pulls digits of factor from left to right. */    int loop;    ULONG nsec = 0;    BOOL shift = FALSE;        /* Shifted to avoid overflow? */    /*      * Adjust large values so that no intermediate calculation exceeds      * 32 bits. (This test is overkill, since the fourth MSB can be set      * sometimes, but it's fast).     */     if (sntpFraction & 0xF0000000)        {        sntpFraction /= 10;        shift = TRUE;        }    /*      * In order to increase portability, the following conversion avoids     * floating point operations, so it is somewhat obscure.     *     * Incrementing the NTP fractional part increases the corresponding     * decimal value by 2^(-32). By interpreting the fractional part as an     * integer representing the number of increments, the equivalent decimal     * value is equal to the product of the fractional part and 0.2328306437.     * That value is the mantissa for 2^(-32). Multiplying by 2.328306437E-10     * would convert the NTP fractional part into the equivalent in seconds.     *     * The mask variable selects each digit from the factor sequentially, and     * the divisor shifts the digit the appropriate number of decimal places.      * The initial value of the divisor is 10 instead of 1E10 so that the      * conversion produces results in nanoseconds, as required by POSIX clocks.     */    for (loop = 0; loop < 10; loop++)    /* Ten digits in mantissa */        {	nsec += sntpFraction * (factor/mask)/divisor;  /* Use current digit. */	factor %= mask;    /* Remove most significant digit from the factor. */	mask /= 10;        /* Reduce length of mask by one. */	divisor *= 10;     /* Increase preceding zeroes by one. */        }    /* Scale result upwards if value was adjusted before processing. */    if (shift)        nsec *= 10;    return (nsec);    }/********************************************************************************* sntpcTimeGet - retrieve the current time from a remote source** This routine stores the current time as reported by an SNTP/NTP server in* the location indicated by <pCurrTime>.  The reported time is first converted* to the elapsed time since January 1, 1970, 00:00, GMT, which is the base value* used by UNIX systems.  If <pServerAddr> is NULL, the routine listens for * messages sent by an SNTP/NTP server in broadcast mode.  Otherwise, this* routine sends a request to the specified SNTP/NTP server and extracts the* reported time from the reply.  In either case, an error is returned if no * message is received within the interval specified by <timeout>.  Typically, * SNTP/NTP servers operating in broadcast mode send update messages every 64 * to 1024 seconds.  An infinite timeout value is specified by WAIT_FOREVER.* * RETURNS: OK, or ERROR if unsuccessful.** ERRNO:*  S_sntpcLib_INVALID_PARAMETER, S_sntpcLib_INVALID_ADDRESS, S_sntpcLib_TIMEOUT,*  S_sntpcLib_SERVER_UNSYNC, S_sntpcLib_VERSION_UNSUPPORTED*/STATUS sntpcTimeGet    (    char * 		pServerAddr, 	/* server IP address or hostname */    u_int 		timeout,	/* timeout interval in ticks */    struct timespec * 	pCurrTime	/* storage for retrieved time value */    )    {    STATUS result;    struct in_addr 	target;    if (pCurrTime == NULL || (timeout < 0 && timeout != WAIT_FOREVER))        {        errnoSet (S_sntpcLib_INVALID_PARAMETER);        return (ERROR);        }    if (pServerAddr == NULL)        result = sntpcListen (timeout, pCurrTime);    else        {        target.s_addr = hostGetByName (pServerAddr);        if (target.s_addr == ERROR)            target.s_addr = inet_addr (pServerAddr);            if (target.s_addr == ERROR)            {            errnoSet (S_sntpcLib_INVALID_ADDRESS);            return (ERROR);            }        result = sntpcFetch (&target, timeout, pCurrTime);         }    return (result);    }/********************************************************************************* sntpcFetch - send an SNTP request and retrieve the time from the reply** This routine sends an SNTP request to the IP address specified by* <pTargetAddr>, converts the returned NTP timestamp to the POSIX-compliant * clock format with the UNIX base value (elapsed time since 00:00 GMT on * Jan. 1, 1970), and stores the result in the location indicated by <pTime>.* * RETURNS: OK, or ERROR if unsuccessful.** ERRNO:*  S_sntpcLib_SERVER_UNSYNC*  S_sntpcLib_VERSION_UNSUPPORTED*  S_sntpcLib_TIMEOUT** NOMANUAL*/LOCAL STATUS sntpcFetch    (    struct in_addr * 	pTargetAddr, 	/* SNTP/NTP server IP address */    u_int 		timeout,	/* timeout in ticks */    struct timespec * 	pCurrTime	/* storage for retrieved time value */    )    {    SNTP_PACKET sntpRequest;     /* sntp request packet for */                                 /* transmission to server */    SNTP_PACKET sntpReply;       /* buffer for server reply */    struct sockaddr_in dstAddr;    struct sockaddr_in servAddr;    struct timeval sockTimeout;    int optval;    int clockRate;    int sntpSocket;    fd_set readFds;    int result;    int servAddrLen;      /* Set destination for request. */      bzero ( (char *)&dstAddr, sizeof (dstAddr));    dstAddr.sin_addr.s_addr = pTargetAddr->s_addr;    dstAddr.sin_family = AF_INET;    dstAddr.sin_port = sntpcPort;      /* Create socket for transmission. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人99久久亚洲综合精品| 色婷婷一区二区三区四区| 国产精品1区二区.| 欧洲在线/亚洲| 国产喂奶挤奶一区二区三区| 亚洲最大色网站| av资源站一区| 欧美r级在线观看| 亚洲h在线观看| 99久久国产免费看| 国产偷国产偷亚洲高清人白洁| 成人黄色电影在线| 91精品国产综合久久精品app | 天天影视网天天综合色在线播放| 国产一区二区三区精品视频| 欧美日本在线一区| 一区二区三区在线视频免费| 国产福利91精品| 日韩网站在线看片你懂的| 亚洲激情自拍视频| 91视频国产观看| 国产精品嫩草99a| 国产精品一卡二卡| 精品久久久久久无| 久久激五月天综合精品| 欧美一级免费观看| 日韩精品视频网| 欧美日韩在线观看一区二区 | 精品国产1区2区3区| 青青草国产成人av片免费| 欧美三片在线视频观看| 亚洲激情综合网| 色狠狠av一区二区三区| 亚洲婷婷综合色高清在线| 99国产精品国产精品久久| 国产精品日韩精品欧美在线| 成人综合在线网站| 中文字幕一区二| 99久久99久久精品免费观看| 精品伊人久久久久7777人| 欧美日韩一级二级三级| 亚洲第一福利一区| 91精品国产全国免费观看| 日韩电影在线一区二区| 欧美一卡二卡在线| 国产专区欧美精品| 国产女人18毛片水真多成人如厕| 成人伦理片在线| 亚洲美女视频在线观看| 欧美日韩电影一区| 久久99久久久久久久久久久| 欧美电视剧在线看免费| 国产成人av一区二区三区在线 | 国产精品毛片高清在线完整版| 白白色 亚洲乱淫| 亚洲欧美另类小说视频| 欧美美女激情18p| 久久国产视频网| 国产精品网曝门| 色婷婷精品久久二区二区蜜臀av| 视频一区视频二区中文| 精品欧美一区二区三区精品久久| 国产成人综合在线观看| 亚洲欧美激情小说另类| 日韩女优av电影| 99re热这里只有精品免费视频 | 国产精品国产三级国产| 91视频.com| 美国av一区二区| 中文字幕一区二区三区不卡| 9191精品国产综合久久久久久 | 不卡在线视频中文字幕| 亚洲国产另类av| 久久亚洲捆绑美女| 日本黄色一区二区| 精品在线一区二区| 亚洲二区在线视频| 国产午夜亚洲精品午夜鲁丝片| 欧美性淫爽ww久久久久无| 久久国产精品99精品国产| 亚洲免费观看高清在线观看| 日韩一级二级三级| 日本高清不卡视频| 成人免费毛片嘿嘿连载视频| 五月开心婷婷久久| 亚洲欧美电影一区二区| 久久久久久电影| 欧美日韩激情一区二区| www.欧美色图| 激情亚洲综合在线| 日韩国产欧美在线视频| 亚洲精品欧美在线| 国产欧美日韩卡一| 26uuu另类欧美| 欧美日韩国产高清一区二区| 91丨porny丨在线| 国产剧情一区二区三区| 久久精品国产亚洲高清剧情介绍| 亚洲综合一区二区三区| 亚洲人一二三区| 国产精品三级久久久久三级| 久久在线观看免费| 日韩欧美黄色影院| 777精品伊人久久久久大香线蕉| 色综合av在线| 成人a级免费电影| 丁香天五香天堂综合| 蓝色福利精品导航| 美女精品一区二区| 美国毛片一区二区| 蜜臀av在线播放一区二区三区| 性做久久久久久久免费看| 一区二区三区欧美激情| 亚洲精品午夜久久久| 中文字幕在线不卡视频| 欧美激情一区二区在线| 国产亚洲精品精华液| 久久久天堂av| 久久色.com| 国产午夜三级一区二区三| 欧美精品一区二区三区蜜桃| 精品国一区二区三区| 日韩精品一区二区三区swag | 婷婷综合久久一区二区三区| 亚洲精品免费在线观看| 尤物在线观看一区| 亚洲制服欧美中文字幕中文字幕| 一区二区三区在线视频观看58| 夜夜揉揉日日人人青青一国产精品 | 91免费看`日韩一区二区| 波多野结衣中文一区| 成人一二三区视频| 91老师国产黑色丝袜在线| 色综合久久88色综合天天6| 欧美色网一区二区| 欧美一区二区三区在线观看| 欧美videos大乳护士334| 久久久久亚洲综合| 亚洲精品亚洲人成人网| 同产精品九九九| 久久99这里只有精品| 成人免费看的视频| 欧美午夜精品久久久久久孕妇| 欧美美女网站色| 久久精品视频一区二区| 亚洲三级电影全部在线观看高清| 亚洲不卡一区二区三区| 久久99在线观看| 97久久精品人人做人人爽| 欧美日韩中文一区| 精品国产人成亚洲区| 国产欧美日本一区视频| 亚洲成人免费电影| 国产精品伊人色| 欧美最猛性xxxxx直播| 精品裸体舞一区二区三区| 亚洲欧美日韩国产中文在线| 免费欧美日韩国产三级电影| 成人理论电影网| 欧美丰满少妇xxxxx高潮对白| 国产女人aaa级久久久级 | 久久aⅴ国产欧美74aaa| 91免费版在线| 26uuu色噜噜精品一区二区| 一区二区三区成人| 看电视剧不卡顿的网站| 91丝袜国产在线播放| 精品欧美一区二区久久| 亚洲韩国一区二区三区| 成人网在线播放| 日韩精品一区二区三区中文不卡 | 久久综合色鬼综合色| 亚洲在线观看免费| 成人激情动漫在线观看| 精品福利一二区| 午夜欧美在线一二页| 91免费在线视频观看| 国产日韩精品久久久| 美日韩一区二区三区| 在线观看亚洲精品视频| 欧美国产精品专区| 国内精品第一页| 91精品国产一区二区人妖| 亚洲永久免费av| 色婷婷激情综合| 国产精品人妖ts系列视频| 激情五月婷婷综合| 日韩女优电影在线观看| 日韩精品每日更新| 欧美日韩精品专区| 亚洲成a人在线观看| 91福利视频久久久久| 亚洲色图视频免费播放| aaa亚洲精品| 国产精品久久三| 国产91富婆露脸刺激对白| 久久久久久久久久久久久女国产乱| 日本91福利区| 欧美一卡二卡三卡四卡| 美腿丝袜亚洲综合|