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

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

?? 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. */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩极品在线观看一区| 亚洲专区一二三| 欧美精品一二三四| 在线视频一区二区三| 不卡在线视频中文字幕| 国产99久久久久| 国产91在线看| 99精品国产91久久久久久| 成人美女在线视频| 国产精品66部| 成人黄色av电影| eeuss鲁片一区二区三区在线看| 国产在线一区观看| 国产一区二三区| 国产一区二区三区免费| 久久se这里有精品| 国产激情精品久久久第一区二区 | 成人一级黄色片| 丁香另类激情小说| 色94色欧美sute亚洲线路二 | 日本va欧美va欧美va精品| 日日夜夜精品视频天天综合网| 免费在线看成人av| 风间由美中文字幕在线看视频国产欧美| 国产超碰在线一区| 欧美色精品在线视频| 日韩欧美国产午夜精品| 国产精品美女久久久久久久久久久 | 国产91精品一区二区麻豆网站| 成人av资源下载| 538在线一区二区精品国产| 国产视频911| 亚洲成av人片观看| 国产一区二区不卡在线| 欧美色综合久久| 国产亚洲成aⅴ人片在线观看| 亚洲精品视频在线观看网站| 精品一区免费av| 色拍拍在线精品视频8848| 久久午夜老司机| 午夜成人免费视频| 成人午夜电影网站| 日韩亚洲欧美一区二区三区| 亚洲欧美日韩一区| 国产精品一二三四区| 欧美日韩久久不卡| 亚洲免费观看高清完整版在线观看熊 | 色国产精品一区在线观看| 欧美变态口味重另类| 亚洲一区二区精品3399| 成人午夜碰碰视频| 精品国产乱码久久久久久久| 亚洲一区二区三区在线播放| 成人精品一区二区三区中文字幕 | 国产在线不卡视频| 欧美视频一区在线观看| 中文一区在线播放| 国内精品伊人久久久久影院对白| 欧美在线播放高清精品| 亚洲欧洲性图库| 国产999精品久久| 国产喂奶挤奶一区二区三区| 韩国午夜理伦三级不卡影院| 7777精品伊人久久久大香线蕉经典版下载 | 精品在线播放午夜| 欧美妇女性影城| 视频在线观看一区二区三区| 欧美在线999| 一区二区视频在线| 在线日韩一区二区| 亚洲精品久久嫩草网站秘色| 99国产精品视频免费观看| 日本一区二区三区在线观看| 国产精品一区专区| 欧美国产精品久久| 粉嫩av一区二区三区粉嫩| 国产网红主播福利一区二区| 成人综合在线网站| 国产精品女上位| 91社区在线播放| 亚洲一区二区三区四区不卡| 7777女厕盗摄久久久| 精品一区二区在线视频| 久久精品视频免费观看| 成人黄色在线网站| 亚洲黄色录像片| 欧美一a一片一级一片| 欧美aⅴ一区二区三区视频| 欧美va亚洲va在线观看蝴蝶网| 国产综合色产在线精品 | 欧洲日韩一区二区三区| 国产亲近乱来精品视频| bt7086福利一区国产| 亚洲精品视频在线观看免费| 欧美精品一级二级三级| 久久精品av麻豆的观看方式| 国产日韩欧美综合一区| 91麻豆swag| 日韩精品一二三| 亚洲国产精品av| 欧美三级电影网站| 国产盗摄女厕一区二区三区| 亚洲色图另类专区| 欧美不卡一区二区| 色先锋aa成人| 精品一区二区免费看| 亚洲欧美日韩国产手机在线| 欧美麻豆精品久久久久久| 日韩电影在线一区| 成人欧美一区二区三区1314| 在线成人小视频| 不卡一区中文字幕| 老司机精品视频导航| 亚洲人成小说网站色在线| 日韩亚洲欧美在线观看| 99久久精品免费观看| 捆绑调教一区二区三区| 综合色中文字幕| 精品福利一区二区三区| 欧美日韩国产电影| 99久久综合国产精品| 久久99精品国产麻豆婷婷 | 欧美顶级少妇做爰| 成人一区二区三区中文字幕| 日本亚洲视频在线| 亚洲在线成人精品| 自拍偷拍欧美激情| 国产欧美精品一区| 精品噜噜噜噜久久久久久久久试看| 91久久免费观看| 成人v精品蜜桃久久一区| 精品一区二区免费看| 午夜精品爽啪视频| 樱桃视频在线观看一区| 亚洲国产成人一区二区三区| 精品久久久久久最新网址| 欧美日韩视频在线观看一区二区三区 | 国产一区二区不卡在线| 日韩av电影免费观看高清完整版 | 欧美美女一区二区三区| 色综合色综合色综合色综合色综合| 精品一区二区三区日韩| 日本aⅴ免费视频一区二区三区| 亚洲精选视频免费看| 国产精品久久久久久久浪潮网站| 久久久美女毛片| 2020日本不卡一区二区视频| 精品国产一区二区三区久久久蜜月 | 国产一区二区免费看| 精品一区二区在线播放| 极品少妇一区二区三区精品视频 | 久久免费精品国产久精品久久久久| 日韩一区二区在线看片| 91精品久久久久久蜜臀| 欧美一级久久久| 日韩欧美区一区二| 欧美成人a在线| 日韩欧美国产午夜精品| 精品毛片乱码1区2区3区| 欧美成人伊人久久综合网| 91麻豆精品久久久久蜜臀| 欧美美女bb生活片| 91精品国产日韩91久久久久久| 91精品欧美一区二区三区综合在| 69精品人人人人| 精品国产一区二区亚洲人成毛片| 国产欧美一区二区三区在线看蜜臀| 国产精品久久久久久久久免费相片 | 26uuu国产电影一区二区| 国产三级一区二区三区| 最新国产成人在线观看| 日韩影院免费视频| 精品系列免费在线观看| www.色综合.com| 欧美日韩专区在线| www成人在线观看| 亚洲色大成网站www久久九九| 亚洲国产精品视频| 国内精品久久久久影院色| 不卡av电影在线播放| 欧美高清性hdvideosex| 久久久久久一级片| 亚洲一区av在线| 韩国av一区二区三区四区| hitomi一区二区三区精品| 欧美乱妇20p| 日本一区二区高清| 婷婷综合另类小说色区| 国产99久久久久| 正在播放一区二区| 综合欧美一区二区三区| 精品一区二区在线观看| 在线观看免费视频综合| 精品久久久久久无| 香蕉加勒比综合久久| 成人av电影免费在线播放| 日韩精品中午字幕| 亚洲国产成人tv| 福利一区二区在线| 日韩欧美国产综合一区|