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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sntpclib.c

?? vxwork源代碼
?? 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. */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色免费短视频| 国内精品第一页| 精品少妇一区二区三区视频免付费| 国产一区二区三区四区五区美女 | 亚洲激情自拍偷拍| 制服丝袜亚洲网站| 成人国产亚洲欧美成人综合网| 日本伊人色综合网| 亚洲精品视频一区二区| 国产日韩欧美在线一区| 欧美一区二区三区思思人| 91老师片黄在线观看| 国产成人亚洲综合a∨婷婷图片| 亚洲18影院在线观看| 亚洲人成网站色在线观看| 久久五月婷婷丁香社区| 日韩视频免费直播| 欧美日韩免费在线视频| 色综合中文字幕国产 | 久久黄色级2电影| 亚洲一区免费视频| 亚洲丝袜美腿综合| 亚洲国产精品成人综合色在线婷婷| 欧美精品v国产精品v日韩精品| 91麻豆国产精品久久| 国产盗摄一区二区| 国产尤物一区二区| 在线精品视频免费观看| 麻豆91精品91久久久的内涵| 国产片一区二区| 精品久久国产97色综合| 欧美色精品在线视频| 色老汉av一区二区三区| 日本韩国欧美三级| 色综合一区二区| 欧美在线不卡一区| 99精品黄色片免费大全| 成人avav影音| 91在线丨porny丨国产| 成人短视频下载| 成人av中文字幕| 成人av综合一区| 99精品黄色片免费大全| 色天使色偷偷av一区二区| 日本乱码高清不卡字幕| 在线观看视频一区| 欧美日韩国产一二三| 91精品国产麻豆国产自产在线| 欧美一区二区在线播放| 精品区一区二区| 久久精品一区二区三区不卡牛牛 | 亚洲国产日韩精品| 日韩一区二区免费在线电影| 欧美一二三四区在线| 精品免费一区二区三区| 久久久久久影视| 国产无人区一区二区三区| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 久久久青草青青国产亚洲免观| 久久日韩精品一区二区五区| 欧美国产一区在线| 亚洲欧美日韩小说| 性欧美大战久久久久久久久| 日韩精品乱码免费| 久久99精品久久久久婷婷| 国产精品羞羞答答xxdd| 91丨porny丨户外露出| 在线观看av不卡| 欧美大胆人体bbbb| 中文字幕精品一区二区精品绿巨人| **欧美大码日韩| 日产国产欧美视频一区精品 | 狠狠色伊人亚洲综合成人| 国产成人在线视频网站| 在线日韩国产精品| 日韩精品最新网址| 成人免费在线播放视频| 日本中文字幕一区二区有限公司| 国产麻豆视频精品| 欧洲亚洲国产日韩| 久久久99精品久久| 亚洲一区二区欧美日韩| 国产真实精品久久二三区| 99久久er热在这里只有精品66| 欧美剧在线免费观看网站| 中文字幕精品在线不卡| 亚洲丶国产丶欧美一区二区三区| 精品亚洲成a人| 在线亚洲精品福利网址导航| 欧美精品一区二区三区蜜桃| 国产精品成人在线观看| 免费看欧美美女黄的网站| 成人精品一区二区三区中文字幕| 欧美浪妇xxxx高跟鞋交| 亚洲日本在线天堂| 狠狠色丁香久久婷婷综合_中 | 精品一区二区三区日韩| 91免费看片在线观看| 日韩精品在线一区| 一级中文字幕一区二区| 国产成人无遮挡在线视频| 欧美乱熟臀69xxxxxx| 亚洲色图欧洲色图| 国模一区二区三区白浆| 欧美日韩国产经典色站一区二区三区| 国产欧美一区二区三区网站| 日本va欧美va精品发布| 欧美在线免费视屏| 亚洲欧洲av在线| 国产一区二区精品久久91| 91精品国产综合久久福利软件 | 狠狠久久亚洲欧美| 777欧美精品| 一区二区三区不卡视频在线观看| 丁香激情综合五月| 久久色视频免费观看| 麻豆传媒一区二区三区| 欧美精品乱码久久久久久| 亚洲精品免费视频| 91欧美一区二区| 国产精品私人影院| 国产精品白丝av| 精品国产乱码久久久久久老虎| 人妖欧美一区二区| 欧美精品在欧美一区二区少妇 | 成人黄色一级视频| 亚洲不卡av一区二区三区| 久久久久久免费网| 亚洲第一福利视频在线| 国产成人精品一区二| 欧美v日韩v国产v| 三级欧美在线一区| 欧美日韩免费高清一区色橹橹| 亚洲图片欧美综合| 99久久综合狠狠综合久久| 91精品欧美一区二区三区综合在| 亚洲成人久久影院| 欧美tk—视频vk| av午夜一区麻豆| 日韩中文欧美在线| 日本一区二区三区电影| 欧美在线短视频| 国内成人自拍视频| 亚洲女人的天堂| 日韩免费视频一区| 91在线视频观看| 免费欧美在线视频| 一区视频在线播放| 欧美一区二区私人影院日本| 成人动漫精品一区二区| 午夜一区二区三区视频| 国产色一区二区| 欧美色综合天天久久综合精品| 韩国一区二区视频| 夜夜精品视频一区二区 | 精品国产乱码久久久久久久| 99国内精品久久| 久草这里只有精品视频| 亚洲色图制服丝袜| 久久综合九色综合97_久久久| 日本高清不卡在线观看| 国产精品自在欧美一区| 午夜精品影院在线观看| 中文字幕欧美日韩一区| 日韩午夜中文字幕| 欧洲国内综合视频| 成人激情免费视频| 九九**精品视频免费播放| 亚洲一区二区三区爽爽爽爽爽| 国产亚洲精品免费| 这里是久久伊人| 欧美专区亚洲专区| 成人a免费在线看| 国内精品国产成人| 日韩成人伦理电影在线观看| 亚洲美女免费视频| 中文字幕的久久| 精品久久国产字幕高潮| 欧美日韩精品欧美日韩精品| 91免费看片在线观看| 国产成人av一区| 国内精品久久久久影院薰衣草| 日韩精品乱码av一区二区| 亚洲精品免费在线观看| 国产精品高清亚洲| 久久精品免视看| 久久午夜国产精品| 日韩精品一区二区三区swag| 欧美精品777| 欧美综合一区二区三区| 91在线观看美女| 成人av网址在线观看| 国产成人av资源| 国产精品一区二区x88av| 精品亚洲免费视频| 精品一二三四在线| 精品亚洲欧美一区| 精品一区二区三区久久久| 奇米777欧美一区二区| 午夜精品久久久久久久久久久|