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

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

?? refclock_arc.c

?? 網絡時間協議NTP 源碼 版本v4.2.0b 該源碼用于linux平臺下
?? C
?? 第 1 頁 / 共 4 頁
字號:
	/* Compute space left in buffer after any pending output. */	for(spaceleft = 0; spaceleft < CMDQUEUELEN; ++spaceleft)	{ if(up->cmdqueue[CMDQUEUELEN - 1 - spaceleft] != '\0') { break; } }	return(spaceleft);}/*Send command by copying into command buffer as far forward as possible,after any pending output.Indicate an error by returning 0 if there is not space for the command.*/static intsend_slow(	register struct arcunit *up,	int fd,	const char *s	){	int sl = strlen(s);	int spaceleft = space_left(up);#ifdef DEBUG	if(debug > 1) { printf("arc: spaceleft = %d.\n", spaceleft); }#endif	if(spaceleft < sl) { /* Should not normally happen... */#ifdef DEBUG		msyslog(LOG_NOTICE, "ARCRON: send-buffer overrun (%d/%d)",		       sl, spaceleft);#endif		return(0);                      /* FAILED! */	}	/* Copy in the command to be sent. */	while(*s) { up->cmdqueue[CMDQUEUELEN - spaceleft--] = *s++; }	return(1);}static intget2(char *p, int *val){  if (!isdigit((int)p[0]) || !isdigit((int)p[1])) return 0;  *val = (p[0] - '0') * 10 + p[1] - '0';  return 1;}static intget1(char *p, int *val){  if (!isdigit((int)p[0])) return 0;  *val = p[0] - '0';  return 1;}/* Macro indicating action we will take for different quality values. */#define quality_action(q) \(((q) == QUALITY_UNKNOWN) ?         "UNKNOWN, will use clock anyway" : \ (((q) < MIN_CLOCK_QUALITY_OK) ? "TOO POOR, will not use clock" : \  "OK, will use clock"))     /* * arc_receive - receive data from the serial interface */     static voidarc_receive(	struct recvbuf *rbufp	){	register struct arcunit *up;	struct refclockproc *pp;	struct peer *peer;	char c;	int i, n, wday, month, flags, status;	int arc_last_offset;	static int quality_average = 0;	static int quality_sum = 0;	static int quality_polls = 0;	/*	 * Initialize pointers and read the timecode and timestamp	 */	peer = (struct peer *)rbufp->recv_srcclock;	pp = peer->procptr;	up = (struct arcunit *)pp->unitptr;	/*	  If the command buffer is empty, and we are resyncing, insert a	  g\r quality request into it to poll for signal quality again.	*/	if((up->resyncing) && (space_left(up) == CMDQUEUELEN)) {#ifdef DEBUG		if(debug > 1) { printf("arc: inserting signal-quality poll.\n"); }#endif		send_slow(up, pp->io.fd, "g\r");	}	/*	  The `arc_last_offset' is the offset in lastcode[] of the last byte	  received, and which we assume actually received the input	  timestamp.	  (When we get round to using tty_clk and it is available, we	  assume that we will receive the whole timecode with the	  trailing \r, and that that \r will be timestamped.  But this	  assumption also works if receive the characters one-by-one.)	*/	arc_last_offset = pp->lencode+rbufp->recv_length - 1;	/*	  We catch a timestamp iff:	  * The command code is `o' for a timestamp.	  * If ARCRON_MULTIPLE_SAMPLES is undefined then we must have	  exactly char in the buffer (the command code) so that we	  only sample the first character of the timecode as our	  `on-time' character.	  * The first character in the buffer is not the echoed `\r'	  from the `o` command (so if we are to timestamp an `\r' it	  must not be first in the receive buffer with lencode==1.	  (Even if we had other characters following it, we probably	  would have a premature timestamp on the '\r'.)	  * We have received at least one character (I cannot imagine	  how it could be otherwise, but anyway...).	*/	c = rbufp->recv_buffer[0];	if((pp->a_lastcode[0] == 'o') &&#ifndef ARCRON_MULTIPLE_SAMPLES	   (pp->lencode == 1) &&#endif	   ((pp->lencode != 1) || (c != '\r')) &&	   (arc_last_offset >= 1)) {		/* Note that the timestamp should be corrected if >1 char rcvd. */		l_fp timestamp;		timestamp = rbufp->recv_time;#ifdef DEBUG		if(debug) { /* Show \r as `R', other non-printing char as `?'. */			printf("arc: stamp -->%c<-- (%d chars rcvd)\n",			       ((c == '\r') ? 'R' : (isgraph((int)c) ? c : '?')),			       rbufp->recv_length);		}#endif		/*		  Now correct timestamp by offset of last byte received---we		  subtract from the receive time the delay implied by the		  extra characters received.		  Reject the input if the resulting code is too long, but		  allow for the trailing \r, normally not used but a good		  handle for tty_clk or somesuch kernel timestamper.		*/		if(arc_last_offset > LENARC) {#ifdef DEBUG			if(debug) {				printf("arc: input code too long (%d cf %d); rejected.\n",				       arc_last_offset, LENARC);			}#endif			pp->lencode = 0;			refclock_report(peer, CEVNT_BADREPLY);			return;		}		L_SUBUF(&timestamp, charoffsets[arc_last_offset]);#ifdef DEBUG		if(debug > 1) {			printf(				"arc: %s%d char(s) rcvd, the last for lastcode[%d]; -%sms offset applied.\n",				((rbufp->recv_length > 1) ? "*** " : ""),				rbufp->recv_length,				arc_last_offset,				mfptoms((unsigned long)0,					charoffsets[arc_last_offset],					1));		}#endif#ifdef ARCRON_MULTIPLE_SAMPLES		/*		  If taking multiple samples, capture the current adjusted		  sample iff:		  * No timestamp has yet been captured (it is zero), OR		  * This adjusted timestamp is earlier than the one already		  captured, on the grounds that this one suffered less		  delay in being delivered to us and is more accurate.		*/		if(L_ISZERO(&(up->lastrec)) ||		   L_ISGEQ(&(up->lastrec), &timestamp))#endif		{#ifdef DEBUG			if(debug > 1) {				printf("arc: system timestamp captured.\n");#ifdef ARCRON_MULTIPLE_SAMPLES				if(!L_ISZERO(&(up->lastrec))) {					l_fp diff;					diff = up->lastrec;					L_SUB(&diff, &timestamp);					printf("arc: adjusted timestamp by -%sms.\n",					       mfptoms(diff.l_i, diff.l_f, 3));				}#endif			}#endif			up->lastrec = timestamp;		}	}	/* Just in case we still have lots of rubbish in the buffer... */	/* ...and to avoid the same timestamp being reused by mistake, */	/* eg on receipt of the \r coming in on its own after the      */	/* timecode.                                                   */	if(pp->lencode >= LENARC) {#ifdef DEBUG		if(debug && (rbufp->recv_buffer[0] != '\r'))		{ printf("arc: rubbish in pp->a_lastcode[].\n"); }#endif		pp->lencode = 0;		return;	}	/* Append input to code buffer, avoiding overflow. */	for(i = 0; i < rbufp->recv_length; i++) {		if(pp->lencode >= LENARC) { break; } /* Avoid overflow... */		c = rbufp->recv_buffer[i];		/* Drop trailing '\r's and drop `h' command echo totally. */		if(c != '\r' && c != 'h') { pp->a_lastcode[pp->lencode++] = c; }		/*		  If we've just put an `o' in the lastcode[0], clear the		  timestamp in anticipation of a timecode arriving soon.		  We would expect to get to process this before any of the		  timecode arrives.		*/		if((c == 'o') && (pp->lencode == 1)) {			L_CLR(&(up->lastrec));#ifdef DEBUG			if(debug > 1) { printf("arc: clearing timestamp.\n"); }#endif		}	}	if (pp->lencode == 0) return;	/* Handle a quality message. */	if(pp->a_lastcode[0] == 'g') {		int r, q;		if(pp->lencode < 3) { return; } /* Need more data... */		r = (pp->a_lastcode[1] & 0x7f); /* Strip parity. */		q = (pp->a_lastcode[2] & 0x7f); /* Strip parity. */		if(((q & 0x70) != 0x30) || ((q & 0xf) > MAX_CLOCK_QUALITY) ||		   ((r & 0x70) != 0x30)) {			/* Badly formatted response. */#ifdef DEBUG			if(debug) { printf("arc: bad `g' response %2x %2x.\n", r, q); }#endif			return;		}		if(r == '3') { /* Only use quality value whilst sync in progress. */			if (up->quality_stamp < current_time) {				struct calendar cal;				l_fp new_stamp;							get_systime (&new_stamp);				caljulian (new_stamp.l_ui, &cal);				up->quality_stamp = 					current_time + 60 - cal.second + 5;				quality_sum = 0;				quality_polls = 0;			}			quality_sum += (q & 0xf);			quality_polls++;			quality_average = (quality_sum / quality_polls);#ifdef DEBUG			if(debug) { printf("arc: signal quality %d (%d).\n", quality_average, (q & 0xf)); }#endif		} else if( /* (r == '2') && */ up->resyncing) {			up->quality = quality_average;#ifdef DEBUG			if(debug)			{				printf("arc: sync finished, signal quality %d: %s\n",				       up->quality,				       quality_action(up->quality));			}#endif			msyslog(LOG_NOTICE,			       "ARCRON: sync finished, signal quality %d: %s",			       up->quality,			       quality_action(up->quality));			up->resyncing = 0; /* Resync is over. */			quality_average = 0;			quality_sum = 0;			quality_polls = 0;#ifdef ARCRON_KEEN			/* Clock quality dubious; resync earlier than usual. */			if((up->quality == QUALITY_UNKNOWN) ||			   (up->quality < MIN_CLOCK_QUALITY_OK))			{ up->next_resync = current_time + RETRY_RESYNC_TIME; }#endif		}		pp->lencode = 0;		return;	}	/* Stop now if this is not a timecode message. */	if(pp->a_lastcode[0] != 'o') {		pp->lencode = 0;		refclock_report(peer, CEVNT_BADREPLY);		return;	}	/* If we don't have enough data, wait for more... */	if(pp->lencode < LENARC) { return; }	/* WE HAVE NOW COLLECTED ONE TIMESTAMP (phew)... */#ifdef DEBUG	if(debug > 1) { printf("arc: NOW HAVE TIMESTAMP...\n"); }#endif	/* But check that we actually captured a system timestamp on it. */	if(L_ISZERO(&(up->lastrec))) {#ifdef DEBUG		if(debug) { printf("arc: FAILED TO GET SYSTEM TIMESTAMP\n"); }#endif		pp->lencode = 0;		refclock_report(peer, CEVNT_BADREPLY);		return;	}	/*	  Append a mark of the clock's received signal quality for the	  benefit of Derek Mulcahy's Tcl/Tk utility (we map the `unknown'	  quality value to `6' for his s/w) and terminate the string for	  sure.  This should not go off the buffer end.	*/	pp->a_lastcode[pp->lencode] = ((up->quality == QUALITY_UNKNOWN) ?				       '6' : ('0' + up->quality));	pp->a_lastcode[pp->lencode + 1] = '\0'; /* Terminate for printf(). */#ifdef PRE_NTP420	/* We don't use the micro-/milli- second part... */	pp->usec = 0;	pp->msec = 0;#else	/* We don't use the nano-second part... */	pp->nsec = 0;#endif		/* Validate format and numbers. */	if (pp->a_lastcode[0] != 'o'		|| !get2(pp->a_lastcode + 1, &pp->hour)		|| !get2(pp->a_lastcode + 3, &pp->minute)		|| !get2(pp->a_lastcode + 5, &pp->second)		|| !get1(pp->a_lastcode + 7, &wday)		|| !get2(pp->a_lastcode + 8, &pp->day)		|| !get2(pp->a_lastcode + 10, &month)		|| !get2(pp->a_lastcode + 12, &pp->year)) {#ifdef DEBUG		/* Would expect to have caught major problems already... */		if(debug) { printf("arc: badly formatted data.\n"); }#endif		pp->lencode = 0;		refclock_report(peer, CEVNT_BADREPLY);		return;	}	flags = pp->a_lastcode[14];	status = pp->a_lastcode[15];#ifdef DEBUG	if(debug) { printf("arc: status 0x%.2x flags 0x%.2x\n", flags, status); }#endif	n = 9;	/*	  Validate received values at least enough to prevent internal	  array-bounds problems, etc.	*/	if((pp->hour < 0) || (pp->hour > 23) ||	   (pp->minute < 0) || (pp->minute > 59) ||	   (pp->second < 0) || (pp->second > 60) /*Allow for leap seconds.*/ ||	   (wday < 1) || (wday > 7) ||

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美在线一区二区| 中文字幕在线视频一区| 久久久亚洲高清| 亚洲三级理论片| 久久99精品国产| 在线免费观看日韩欧美| 国产亚洲一本大道中文在线| 婷婷丁香激情综合| 在线视频国产一区| 国产精品免费视频一区| 日韩写真欧美这视频| 伊人一区二区三区| 国产白丝网站精品污在线入口| 欧美高清www午色夜在线视频| 中文字幕日韩一区二区| 国产福利一区在线| 日韩欧美一区中文| 日韩精品一二三| 一本久久综合亚洲鲁鲁五月天 | 成人免费av网站| 日韩一级完整毛片| 五月天一区二区三区| 在线观看成人小视频| 中文字幕va一区二区三区| 国产原创一区二区| 欧美xxxx老人做受| 男女视频一区二区| 制服丝袜成人动漫| 免费亚洲电影在线| 欧美一级日韩一级| 视频一区二区不卡| 337p亚洲精品色噜噜| 午夜欧美在线一二页| 欧美日韩一区二区欧美激情| 亚洲一区在线播放| 欧美三级资源在线| 亚洲va欧美va国产va天堂影院| av一区二区三区黑人| 成人免费一区二区三区视频 | 日本视频一区二区| 制服丝袜av成人在线看| 麻豆精品国产91久久久久久| 欧美一区二区三区成人| 久久99久久久久| 久久蜜桃av一区精品变态类天堂 | 日韩中文字幕1| 日韩欧美亚洲国产另类| 国产在线看一区| 亚洲国产精品传媒在线观看| 成人动漫精品一区二区| 一区二区三区不卡视频在线观看| 在线视频国内自拍亚洲视频| 天堂成人国产精品一区| 精品国产网站在线观看| av欧美精品.com| 亚洲一区二区视频| 精品日韩一区二区三区 | 91蜜桃在线免费视频| 亚洲综合区在线| 日韩三级av在线播放| 国产成人夜色高潮福利影视| 中文字幕一区二区三区四区| 欧美日韩在线免费视频| 国产在线播放一区二区三区| 亚洲色图制服诱惑 | 国产欧美一二三区| 色老汉av一区二区三区| 久久精品久久精品| 国产精品久久久一区麻豆最新章节| 在线观看精品一区| 国产麻豆精品在线| 亚洲一区二区三区精品在线| 日韩丝袜美女视频| 99久久精品国产网站| 日韩av在线发布| 国产精品不卡在线| 91精品国产美女浴室洗澡无遮挡| 成人性生交大片免费看中文| 五月婷婷激情综合| 亚洲欧洲在线观看av| 欧美一区二区在线不卡| 97久久精品人人澡人人爽| 麻豆91精品视频| 亚洲综合视频网| 国产精品午夜在线观看| 欧美一区二区三区免费视频 | 国产精品一区三区| 亚洲高清不卡在线| 国产精品久久久久aaaa樱花| 日韩精品中文字幕一区二区三区| 欧美午夜一区二区| 99精品1区2区| 国产91精品露脸国语对白| 蜜桃久久精品一区二区| 亚洲一区二区在线免费观看视频| 国产精品久久久久aaaa樱花| 精品国一区二区三区| 欧美人妇做爰xxxⅹ性高电影 | 欧美高清视频不卡网| 99热精品一区二区| 国产精品亚洲第一区在线暖暖韩国 | 成a人片国产精品| 国产一区二区三区免费在线观看| 日本成人在线不卡视频| 亚洲国产精品自拍| 亚洲精品综合在线| 亚洲欧美日韩综合aⅴ视频| 国产精品天美传媒| 日本一区二区三区dvd视频在线| 777色狠狠一区二区三区| 欧美日韩精品三区| 欧美吻胸吃奶大尺度电影| 91在线国产观看| 91在线丨porny丨国产| 99久久99久久精品免费观看| 99国产精品久久| av不卡在线播放| 99久久精品免费| 色久综合一二码| 欧洲在线/亚洲| 欧美高清视频一二三区| 91精品国产综合久久久久久漫画 | 日韩一二三区不卡| 欧美一区二区三区视频免费| 日韩欧美一区电影| 欧美xxxxx牲另类人与| 欧美精品一区二区精品网| 精品国产凹凸成av人网站| 久久久久久夜精品精品免费| 国产午夜精品久久| 亚洲男人的天堂在线aⅴ视频| 免费欧美在线视频| 人人狠狠综合久久亚洲| 精品无码三级在线观看视频| 国产成人av电影免费在线观看| 成人午夜视频在线观看| 一本一道久久a久久精品综合蜜臀| 欧美综合亚洲图片综合区| 5566中文字幕一区二区电影 | 欧美另类变人与禽xxxxx| 欧美一区二区观看视频| 欧美韩日一区二区三区| 亚洲精品国产视频| 免费av成人在线| 成人黄页在线观看| 欧洲另类一二三四区| 精品久久久久久久人人人人传媒 | 成人欧美一区二区三区黑人麻豆| 一区二区三区国产精华| 久久疯狂做爰流白浆xx| 成人国产亚洲欧美成人综合网| 欧洲精品在线观看| 欧美精品一区二区三区在线 | 94色蜜桃网一区二区三区| 91精品国产综合久久久久久漫画 | 久久天天做天天爱综合色| 自拍偷拍欧美精品| 麻豆精品国产91久久久久久| 91免费看视频| 久久综合九色综合97婷婷 | 欧美中文字幕一区二区三区亚洲| 日韩精品最新网址| 一级日本不卡的影视| 国产一区二区三区四区五区美女| 在线观看日韩毛片| 久久男人中文字幕资源站| 性感美女久久精品| 91小视频免费看| 久久综合丝袜日本网| 午夜私人影院久久久久| eeuss影院一区二区三区 | 国产精品18久久久久久vr| 91麻豆精品国产91久久久使用方法| 国产精品久久久久一区| 黄页视频在线91| 91精品福利在线一区二区三区| 伊人一区二区三区| 成人av网站免费观看| 久久久欧美精品sm网站| 美女精品一区二区| 欧美日本精品一区二区三区| 日韩一区欧美一区| 成人黄色小视频在线观看| 精品乱人伦一区二区三区| 无码av免费一区二区三区试看| a在线播放不卡| 亚洲男人天堂一区| 国产精品2024| 欧美精品一区二区三区蜜桃视频| 日韩高清不卡一区| 欧美日韩精品一区二区在线播放| 亚洲日本在线天堂| 91视频com| 亚洲精品视频在线观看免费| 99久久久免费精品国产一区二区| 日本一区二区不卡视频| 盗摄精品av一区二区三区| 日本一区二区视频在线观看| 国产69精品久久久久777| 欧美激情一区二区三区|