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

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

?? ktime.c

?? 內核中關于nano計時的功能
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*********************************************************************** *								       * * Copyright (c) David L. Mills 1993-2001			       * *								       * * Permission to use, copy, modify, and distribute this software and   * * its documentation for any purpose and without fee is hereby	       * * granted, provided that the above copyright notice appears in all    * * copies and that both the copyright notice and this permission       * * notice appear in supporting documentation, and that the name	       * * University of Delaware not be used in advertising or publicity      * * pertaining to distribution of the software without specific,	       * * written prior permission. The University of Delaware makes no       * * representations about the suitability this software for any	       * * purpose. It is provided "as is" without express or implied	       * * warranty.							       * *								       * **********************************************************************/#include "kern.h"/* * Generic NTP kernel interface * * These routines constitute the Network Time Protocol (NTP) interfaces * for user and daemon application programs. The ntp_gettime() routine * provides the time, maximum error (synch distance) and estimated error * (dispersion) to client user application programs. The ntp_adjtime() * routine is used by the NTP daemon to adjust the system clock to an * externally derived time. The time offset and related variables set by * this routine are used by other routines in this module to adjust the * phase and frequency of the clock discipline loop which controls the * system clock. * * When the kernel time is reckoned directly in nanoseconds (NTP_NANO * defined), the time at each tick interrupt is derived directly from * the kernel time variable. When the kernel time is reckoned in * microseconds, (NTP_NANO undefined), the time is derived from the * kernel time variable together with a variable representing the * leftover nanoseconds at the last tick interrupt. In either case, the * current nanosecond time is reckoned from these values plus an * interpolated value derived by the clock routines in another * architecture-specific module. The interpolation can use either a * dedicated counter or a processor cycle counter (PCC) implemented in * some architectures. * * Note that all routines must run at priority splclock or higher. *//* * Phase/frequency-lock loop (PLL/FLL) definitions * * The nanosecond clock discipline uses two variable types, time * variables and frequency variables. Both types are represented as 64- * bit fixed-point quantities with the decimal point between two 32-bit * halves. On a 32-bit machine, each half is represented as a single * word and mathematical operations are done using multiple-precision * arithmetic. On a 64-bit machine, ordinary computer arithmetic is * used. * * A time variable is a signed 64-bit fixed-point number in ns and * fraction. It represents the remaining time offset to be amortized * over succeeding tick interrupts. The maximum time offset is about * 0.5 s and the resolution is about 2.3e-10 ns. * *			1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |s s s|			 ns				   | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |			    fraction				   | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * A frequency variable is a signed 64-bit fixed-point number in ns/s * and fraction. It represents the ns and fraction to be added to the * kernel time variable at each second. The maximum frequency offset is * about +-500000 ns/s and the resolution is about 2.3e-10 ns/s. * *			1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |s s s s s s s s s s s s s|	          ns/s			   | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |			    fraction				   | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ *//* * The following variables establish the state of the PLL/FLL and the * residual time and frequency offset of the local clock. */#define SHIFT_PLL	4	/* PLL loop gain (shift) */#define SHIFT_FLL	2	/* FLL loop gain (shift) */int time_state = TIME_OK;	/* clock state */int time_status = STA_UNSYNC;	/* clock status bits */long time_tai;			/* TAI offset (s) */long time_monitor;		/* last time offset scaled (ns) */long time_constant;		/* poll interval (shift) (s) */long time_precision = 1;	/* clock precision (ns) */long time_maxerror = MAXPHASE / 1000; /* maximum error (us) */long time_esterror = MAXPHASE / 1000; /* estimated error (us) */long time_reftime;		/* time at last adjustment (s) */long time_tick;			/* nanoseconds per tick (ns) */#if !defined(NTP_NANO)long time_nano;			/* nanoseconds past last tick */#endif /* NTP_NANO */l_fp time_offset;		/* time offset (ns) */l_fp time_freq;			/* frequency offset (ns/s) */l_fp time_adj;			/* tick adjust (ns/s) */l_fp time_phase;		/* time phase (ns) */#ifdef PPS_SYNC/* * The following variables are used when a pulse-per-second (PPS) signal * is available and connected via a modem control lead. They establish * the engineering parameters of the clock discipline loop when * controlled by the PPS signal. */#define PPS_FAVG	2	/* min freq avg interval (s) (shift) */#define PPS_FAVGDEF	8	/* default freq avg int (s) (shift) */#define PPS_FAVGMAX	15	/* max freq avg interval (s) (shift) */#define PPS_PAVG	4	/* phase avg interval (s) (shift) */#define PPS_VALID	120	/* PPS signal watchdog max (s) */#define PPS_MAXWANDER	100000	/* max PPS wander (ns/s) */#define PPS_POPCORN	2	/* popcorn spike threshold (shift) */struct timespec pps_tf[3];	/* phase median filter */l_fp pps_freq;			/* scaled frequency offset (ns/s) */long pps_lastfreq;		/* last scaled freq offset (ns/s) */long pps_fcount;		/* frequency accumulator */long pps_jitter;		/* nominal jitter (ns) */long pps_stabil;		/* nominal stability (scaled ns/s) */long pps_lastcount;		/* last counter offset */long pps_lastsec;		/* time at last calibration (s) */int pps_valid;			/* signal watchdog counter */int pps_shift = PPS_FAVG;	/* interval duration (s) (shift) */int pps_shiftmax = PPS_FAVGDEF;	/* max interval duration (s) (shift) */int pps_intcnt;			/* wander counter *//* * PPS signal quality monitors */long pps_calcnt;		/* calibration intervals */long pps_jitcnt;		/* jitter limit exceeded */long pps_stbcnt;		/* stability limit exceeded */long pps_errcnt;		/* calibration errors */#endif /* PPS_SYNC *//* * End of phase/frequency-lock loop (PLL/FLL) definitions */void hardupdate();/* * ntp_gettime() - NTP user application interface * * See the timex.h header file for synopsis and API description. Note * that the TAI offset is returned in the ntvtimeval.tai structure * member.  */intntp_gettime(tp)	struct ntptimeval *tp;	/* pointer to argument structure */{	struct ntptimeval ntv;	/* temporary structure */	struct timespec atv;	/* nanosecond time */	int s;			/* caller priority */	s = splclock();	nano_time(&atv);#ifdef NTP_NANO	ntv.time.tv_sec = atv.tv_sec;	ntv.time.tv_nsec = atv.tv_nsec;#else	if (!(time_status & STA_NANO))		atv.tv_nsec /= 1000;	ntv.time.tv_sec = atv.tv_sec;	ntv.time.tv_usec = atv.tv_nsec;#endif /* NTP_NANO */	ntv.maxerror = time_maxerror;	ntv.esterror = time_esterror;	ntv.tai = time_tai;	splx(s);	*tp = ntv;		/* copy out the result structure */	/*	 * Status word error decode. If any of these conditions occur,	 * an error is returned, instead of the status word. Most	 * applications will care only about the fact the system clock	 * may not be trusted, not about the details.	 *	 * Hardware or software error	 */	if ((time_status & (STA_UNSYNC | STA_CLOCKERR)) ||	/*	 * PPS signal lost when either time or frequency synchronization	 * requested	 */	    (time_status & (STA_PPSFREQ | STA_PPSTIME) &&	    !(time_status & STA_PPSSIGNAL)) ||	/*	 * PPS jitter exceeded when time synchronization requested	 */	    (time_status & STA_PPSTIME &&	    time_status & STA_PPSJITTER) ||	/*	 * PPS wander exceeded or calibration error when frequency	 * synchronization requested	 */	    (time_status & STA_PPSFREQ &&	    time_status & (STA_PPSWANDER | STA_PPSERROR)))		return (TIME_ERROR);	return (time_state);}/* * ntp_adjtime() - NTP daemon application interface * * See the timex.h header file for synopsis and API description. Note * that the timex.constant structure member has a dual purpose to set * the time constant and to set the TAI offset. */intntp_adjtime(tp)	struct timex *tp;	/* pointer to argument structure */{	struct timex ntv;	/* temporary structure */	long freq;		/* frequency ns/s) */	int modes;		/* mode bits from structure */	int s;			/* caller priority */	ntv = *tp;		/* copy in the argument structure */	/*	 * Update selected clock variables - only the superuser can	 * change anything. Note that there is no error checking here on	 * the assumption the superuser should know what it is doing.	 * Note that either the time constant or TAI offset are loaded	 * from the ntv.constant member, depending on the mode bits. If	 * the STA_PLL bit in the status word is cleared, the state and	 * status words are reset to the initial values at boot.	 */	modes = ntv.modes;	if (ROOT)		return (EPERM);	s = splclock();	if (modes & MOD_MAXERROR)		time_maxerror = ntv.maxerror;	if (modes & MOD_ESTERROR)		time_esterror = ntv.esterror;	if (modes & MOD_STATUS) {		if (time_status & STA_PLL && !(ntv.status & STA_PLL)) {			time_state = TIME_OK;			time_status = STA_UNSYNC;#ifdef PPS_SYNC			pps_shift = PPS_FAVG;#endif /* PPS_SYNC */		}		time_status &= STA_RONLY;		time_status |= ntv.status & ~STA_RONLY;	}	if (modes & MOD_TIMECONST) {		if (ntv.constant < 0)			time_constant = 0;		else if (ntv.constant > MAXTC)			time_constant = MAXTC;		else			time_constant = ntv.constant;	}	if (modes & MOD_TAI) {		if (ntv.constant > 0)			time_tai = ntv.constant;	}#ifdef PPS_SYNC	if (modes & MOD_PPSMAX) {		if (ntv.shift < PPS_FAVG)			pps_shiftmax = PPS_FAVG;		else if (ntv.shift > PPS_FAVGMAX)			pps_shiftmax = PPS_FAVGMAX;		else			pps_shiftmax = ntv.shift;	}#endif /* PPS_SYNC */	if (modes & MOD_NANO)		time_status |= STA_NANO;	if (modes & MOD_MICRO)		time_status &= ~STA_NANO;	if (modes & MOD_CLKB)		time_status |= STA_CLK;	if (modes & MOD_CLKA)		time_status &= ~STA_CLK;	if (modes & MOD_OFFSET) {		if (time_status & STA_NANO)			hardupdate(&TIMEVAR, ntv.offset);		else			hardupdate(&TIMEVAR, ntv.offset * 1000);	}	if (modes & MOD_FREQUENCY) {		freq = ntv.freq / SCALE_PPM;		if (freq > MAXFREQ)			L_LINT(time_freq, MAXFREQ);		else if (freq < -MAXFREQ)			L_LINT(time_freq, -MAXFREQ);		else			L_LINT(time_freq, freq);#ifdef PPS_SYNC		pps_freq = time_freq;#endif /* PPS_SYNC */	}	/*	 * Retrieve all clock variables. Note that the TAI offset is	 * returned only by ntp_gettime();	 */	if (time_status & STA_NANO)		ntv.offset = time_monitor;	else		ntv.offset = time_monitor / 1000;	ntv.freq = L_GINT(time_freq) * SCALE_PPM;	ntv.maxerror = time_maxerror;	ntv.esterror = time_esterror;	ntv.status = time_status;	ntv.constant = time_constant;	if (time_status & STA_NANO)		ntv.precision = time_precision;	else		ntv.precision = time_precision / 1000;	ntv.tolerance = MAXFREQ * SCALE_PPM;#ifdef PPS_SYNC	ntv.shift = pps_shift;	ntv.ppsfreq = L_GINT(pps_freq) * SCALE_PPM;	if (time_status & STA_NANO)		ntv.jitter = pps_jitter;	else		ntv.jitter = pps_jitter / 1000;	ntv.stabil = pps_stabil;	ntv.calcnt = pps_calcnt;	ntv.errcnt = pps_errcnt;	ntv.jitcnt = pps_jitcnt;	ntv.stbcnt = pps_stbcnt;#endif /* PPS_SYNC */	splx(s);	*tp = ntv;		/* copy out the result structure */	/*	 * Status word error decode. See comments in	 * ntp_gettime() routine.	 */	if ((time_status & (STA_UNSYNC | STA_CLOCKERR)) ||	    (time_status & (STA_PPSFREQ | STA_PPSTIME) &&	    !(time_status & STA_PPSSIGNAL)) ||	    (time_status & STA_PPSTIME &&	    time_status & STA_PPSJITTER) ||	    (time_status & STA_PPSFREQ &&	    time_status & (STA_PPSWANDER | STA_PPSERROR)))		return (TIME_ERROR);	return (time_state);}/* * ntp_tick_adjust() - called every tick for precision time adjustment * * This routine is ordinarily called from the tick interrupt routine * hardclock(). To minimize the jitter that might result when a higher * priority interrupt occurs after the tick interrupt is taken and * before the system clock is updated, this routine (and the following * routine second_overflow()) should be called early in the hardclock() * code path.  */voidntp_tick_adjust(tvp, tick_update)#ifdef NTP_NANO	struct timespec *tvp;	/* pointer to nanosecond clock */	int tick_update;	/* residual from adjtime() (ns) */#else	struct timeval *tvp;	/* pointer to microsecond clock */	int tick_update;	/* residual from adjtime() (us) */#endif /* NTP_NANO */{	long ltemp, time_update;	/*	 * Update the nanosecond and microsecond clocks. If the phase	 * increment exceeds the tick period, update the clock phase.	 */#ifdef NTP_NANO	time_update = tick_update;	L_ADD(time_phase, time_adj);	ltemp = L_GINT(time_phase) / hz;	time_update += ltemp;	L_ADDHI(time_phase, -ltemp * hz);	tvp->tv_nsec += time_update;#else	time_update = tick_update;	L_ADD(time_phase, time_adj);	ltemp = L_GINT(time_phase) / (1000 * hz);	time_update += ltemp;	L_ADDHI(time_phase, -ltemp * (1000 * hz));	tvp->tv_usec += time_update;	time_nano = L_GINT(time_phase) / hz;#endif /* NTP_NANO */}/* * second_overflow() - called after ntp_tick_adjust() * * This routine is ordinarily called immediately following the above * routine ntp_tick_adjust(). While these two routines are normally * combined, they are separated here only for the purposes of * simulation. */voidsecond_overflow(tvp)#ifdef NTP_NANO	struct timespec *tvp;	/* pointer to nanosecond clock */#else	struct timeval *tvp;	/* pointer to microsecond clock */#endif /* NTP_NANO */{	l_fp ftemp;		/* 32/64-bit temporary */	/*	 * On rollover of the second both the nanosecond and microsecond	 * clocks are updated and the state machine cranked as	 * necessary. The phase adjustment to be used for the next	 * second is calculated and the maximum error is increased by	 * the tolerance.	 */#ifdef NTP_NANO	if (tvp->tv_nsec >= NANOSECOND) {		tvp->tv_nsec -= NANOSECOND;#else	if (tvp->tv_usec >= 1000000) {		tvp->tv_usec -= 1000000;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲一区在线电影| 国产精品一区2区| 日韩美女视频一区| 一区二区久久久久久| 午夜私人影院久久久久| 婷婷综合另类小说色区| 奇米一区二区三区av| 精品写真视频在线观看| 97se亚洲国产综合自在线不卡| a级高清视频欧美日韩| 欧美人与禽zozo性伦| 337p日本欧洲亚洲大胆色噜噜| ●精品国产综合乱码久久久久| 亚洲www啪成人一区二区麻豆 | 成人黄色777网| 欧美日韩久久不卡| 久久久亚洲综合| 日韩国产欧美视频| 成人app网站| 欧美一卡二卡三卡| 亚洲欧洲另类国产综合| 国产精品影视在线| 91精品国产一区二区三区香蕉| 亚洲精品视频在线看| 韩国女主播成人在线观看| 欧美三级在线看| 国产精品美日韩| 粉嫩一区二区三区性色av| 久久综合999| 国产一区二区三区蝌蚪| 欧美电视剧在线观看完整版| 亚州成人在线电影| 欧美在线播放高清精品| 中文字幕在线不卡视频| 99久久伊人网影院| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 国产资源精品在线观看| 欧美成人一区二区三区在线观看| 蜜桃视频一区二区| 久久综合久久久久88| 粉嫩av亚洲一区二区图片| 国产精品女同一区二区三区| 91在线云播放| 亚洲va韩国va欧美va| 日韩欧美的一区| 国产69精品一区二区亚洲孕妇| 国产精品区一区二区三区 | 欧美一区二区三区影视| 国内成+人亚洲+欧美+综合在线| 久久综合九色综合97婷婷| www.爱久久.com| 视频一区视频二区中文字幕| 久久综合999| 91美女片黄在线| 裸体在线国模精品偷拍| 国产精品女同一区二区三区| 7777精品久久久大香线蕉| 国产专区综合网| 亚洲超碰精品一区二区| 中文字幕乱码一区二区免费| 欧美在线free| 成人av在线观| 秋霞成人午夜伦在线观看| 亚洲综合在线电影| 久久久不卡网国产精品二区| 欧美绝品在线观看成人午夜影视| 国产成人无遮挡在线视频| 日产精品久久久久久久性色| 亚洲精品v日韩精品| 久久久久久亚洲综合影院红桃| 欧美日韩激情一区| 色国产综合视频| 色偷偷成人一区二区三区91| 国产精品99久久久久| 免费人成在线不卡| 亚洲午夜久久久久中文字幕久| 国产精品久久久久久亚洲伦| 久久久久97国产精华液好用吗| 欧洲一区二区三区免费视频| 欧美午夜精品一区二区三区| 99精品黄色片免费大全| 91蜜桃婷婷狠狠久久综合9色| zzijzzij亚洲日本少妇熟睡| 成人一道本在线| 成人国产精品免费观看视频| 国产精品一卡二| 99综合影院在线| 91日韩一区二区三区| 欧美这里有精品| 制服丝袜一区二区三区| 久久女同精品一区二区| 国产精品丝袜一区| 亚洲精品中文字幕乱码三区| 亚洲高清视频中文字幕| 成人国产精品视频| 欧美一区二区三区免费在线看| 日韩欧美国产午夜精品| 国产日韩欧美精品在线| 亚洲精品国产a久久久久久| 丝袜a∨在线一区二区三区不卡| 国产精品夜夜嗨| 欧美唯美清纯偷拍| 国产精品无人区| 日韩不卡一二三区| 国产精品99久久久久久宅男| 欧美色综合久久| 久久久www成人免费毛片麻豆| 亚洲国产视频一区| 成人免费视频网站在线观看| 在线成人免费观看| **欧美大码日韩| 精品一区二区三区久久| 欧美日韩一区视频| 亚洲欧美日韩一区二区三区在线观看| 免费成人美女在线观看.| 国产**成人网毛片九色| 7777精品久久久大香线蕉| 一级做a爱片久久| eeuss鲁片一区二区三区在线观看| 欧美日韩精品一区视频| 亚洲影院理伦片| 欧美性大战久久久久久久蜜臀| 国产精品萝li| 9色porny自拍视频一区二区| 欧美激情一区在线观看| 岛国av在线一区| 亚洲激情六月丁香| 91国产免费观看| 亚洲国产成人av好男人在线观看| 欧美在线观看18| 天堂va蜜桃一区二区三区漫画版| 欧美三级三级三级| 亚洲va天堂va国产va久| 日韩视频免费观看高清完整版在线观看 | 欧美成人精品福利| 国产在线精品一区二区| 日本一区二区成人| 91网站在线观看视频| 日本不卡123| 亚洲色图欧美激情| 91精品视频网| 91丨porny丨首页| 免费av成人在线| 国产精品盗摄一区二区三区| 欧美日韩午夜精品| 视频在线观看国产精品| 亚洲国产精品成人综合| 欧美日韩国产中文| 国产xxx精品视频大全| 午夜a成v人精品| 国产精品日产欧美久久久久| 欧美一级专区免费大片| 91丨porny丨最新| 国产成人自拍高清视频在线免费播放| 亚洲青青青在线视频| 亚洲精品在线免费播放| 色八戒一区二区三区| 国产一区福利在线| 日本在线不卡一区| 一二三四区精品视频| 国产精品欧美综合在线| 久久精品亚洲乱码伦伦中文| 精品视频免费在线| 色综合欧美在线视频区| 国产精品99久久久久久久vr| 国产一区二区三区综合| 青青草国产精品97视觉盛宴| 玉足女爽爽91| 亚洲欧美日韩久久| 亚洲欧美成aⅴ人在线观看| 国产亚洲精品超碰| 久久精品无码一区二区三区| 久久亚洲精品小早川怜子| 欧美精品一区二区高清在线观看 | 亚洲图片欧美综合| 亚洲一区二区av电影| 日韩avvvv在线播放| 麻豆成人91精品二区三区| 国产一区日韩二区欧美三区| 成人天堂资源www在线| 成人av在线一区二区| 在线观看亚洲成人| 日韩一区二区视频| 久久蜜桃一区二区| ...中文天堂在线一区| 午夜私人影院久久久久| 韩国成人在线视频| www.爱久久.com| 7777女厕盗摄久久久| 国产日韩精品久久久| 亚洲高清免费视频| 高清shemale亚洲人妖| 在线精品观看国产| 久久久久久久久蜜桃| 亚洲女同ⅹxx女同tv| 蜜臀久久99精品久久久久久9| 99久久久国产精品| 精品久久久久久无| 亚洲一区国产视频| 北条麻妃一区二区三区|