当前位置: 首页 > news >正文

医院网站后台管理系统登录如何搭建个人网站

医院网站后台管理系统登录,如何搭建个人网站,net建站系统,专门做手工的网站一、NTP介绍 NTP:网络时间协议,英文名称:Network Time Protocol(NTP)是用来使计算机时间同步化的一种协议, 它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化&#xff…

一、NTP介绍

NTP:网络时间协议,英文名称:Network Time Protocol(NTP)是用来使计算机时间同步化的一种协议,
它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),
且可介由加密确认的方式来防止恶毒的协议攻击。NTP的目的是在无序的Internet环境中提供精确和健壮的时间服务。

二、NTP对时机制

Android系统使用NTP自动更新系统时间的触发机制:
1、监听数据库字段AUTO_TIME,也就是开关网络时间选项,当这个字段发生变化的时候,会立即触发一次时间同步
2、网络连接发生变化,当网络接通,会触发一次时间检查和同步
3、定时更新机制,当预定的时间到了,会触发一次时间检查和同步

public void handleMessage(Message msg) {switch (msg.what) {case EVENT_AUTO_TIME_CHANGED:case EVENT_POLL_NETWORK_TIME:case EVENT_NETWORK_CHANGED:onPollNetworkTime(msg.what);break;}
}

三、检查与同步

frameworks/base/services/core/java/com/android/server/NetworkTimeUpdateService.javamPollingIntervalMs = mContext.getResources().getInteger(com.android.internal.R.integer.config_ntpPollingInterval);  // 正常获取网络时间间隔,默认86400000秒,也就是24小时mPollingIntervalShorterMs = mContext.getResources().getInteger( com.android.internal.R.integer.config_ntpPollingIntervalShorter);  // 3次快速尝试获取网络时间,目的是防止网络不好,间隔时间 60000秒,也就是一分钟mTryAgainTimesMax = mContext.getResources().getInteger( com.android.internal.R.integer.config_ntpRetry); // 快速尝试获取网络时间次数,默认三次mTimeErrorThresholdMs = mContext.getResources().getInteger( com.android.internal.R.integer.config_ntpThreshold); // ntp服务器时间与系统时间差阈值,如果大于5秒则更新
以上信息可以通过命令:dumpsys network_time_update_service 查看,例如:
PollingIntervalMs: +1d0h0m0s0ms  
PollingIntervalShorterMs: +1m0s0ms
TryAgainTimesMax: 3
TimeErrorThresholdMs: +5s0ms
TryAgainCounter: 1
LastNtpFetchTime: +1m28s223ms
private void onPollNetworkTimeUnderWakeLock(int event) {final long refTime = SystemClock.elapsedRealtime();// If NITZ time was received less than mPollingIntervalMs time ago,// no need to sync to NTP.if (mNitzTimeSetTime != NOT_SET && refTime - mNitzTimeSetTime < mPollingIntervalMs) {  // 如果开启NITZ 默认使用nitz更新的时间resetAlarm(mPollingIntervalMs);return;}final long currentTime = System.currentTimeMillis();if (DBG) Log.d(TAG, "System time = " + currentTime);// Get the NTP timeif (mLastNtpFetchTime == NOT_SET || refTime >= mLastNtpFetchTime + mPollingIntervalMs|| event == EVENT_AUTO_TIME_CHANGED) {if (DBG) Log.d(TAG, "Before Ntp fetch");// force refresh NTP cache when outdatedif (mTime.getCacheAge() >= mPollingIntervalMs) {    // 开机没有获取到网络时间,强制执行连接ntp服务器获取时间mTime.forceRefresh();}// only update when NTP time is freshif (mTime.getCacheAge() < mPollingIntervalMs) {      // 如果已经获取到网络时间,计算时间差并设置系统时间final long ntp = mTime.currentTimeMillis();mTryAgainCounter = 0;// If the clock is more than N seconds off or this is the first time it's been// fetched since boot, set the current time.if (Math.abs(ntp - currentTime) > mTimeErrorThresholdMs  // 时间差小于5秒 ,则更新时间|| mLastNtpFetchTime == NOT_SET) {// Set the system timeif (DBG && mLastNtpFetchTime == NOT_SET&& Math.abs(ntp - currentTime) <= mTimeErrorThresholdMs) {Log.d(TAG, "For initial setup, rtc = " + currentTime);}if (DBG) Log.d(TAG, "Ntp time to be set = " + ntp);// Make sure we don't overflow, since it's going to be converted to an intif (ntp / 1000 < Integer.MAX_VALUE) {SystemClock.setCurrentTimeMillis(ntp);   // 更新系统时间,LOG为:AlarmManagerService: Setting time of day to sec=1721811969,查看时间是否更新}} else {if (DBG) Log.d(TAG, "Ntp time is close enough = " + ntp);}mLastNtpFetchTime = SystemClock.elapsedRealtime();} else {// Try again shortlymTryAgainCounter++;if (mTryAgainTimesMax < 0 || mTryAgainCounter <= mTryAgainTimesMax) {   // 如果没有获取到网络时间,就间隔一分钟后重试resetAlarm(mPollingIntervalShorterMs);} else {// Try much later       mTryAgainCounter = 0;resetAlarm(mPollingIntervalMs);  // 尝试三次 间隔一分钟获取一次还没有获取到时 ,则24小时后再尝试}return;}}resetAlarm(mPollingIntervalMs);  // 时间已经设置成功,24小时后再获取}
frameworks/base/core/java/android/util/NtpTrustedTime.javafinal String defaultServer = res.getString(com.android.internal.R.string.config_ntpServer); // 默认NTP服务器:2.android.pool.ntp.orgfinal long defaultTimeout = res.getInteger( com.android.internal.R.integer.config_ntpTimeout);  // 连接NTP服务器超时时间默认5秒final String secureServer = Settings.Global.getString( resolver, Settings.Global.NTP_SERVER); // 可以通过命令动态修改ntp服务器,重启后生效 adb shell settings put global ntp_server ntp2.aliyun.comfinal long timeout = Settings.Global.getLong( resolver, Settings.Global.NTP_TIMEOUT, defaultTimeout); // 可以通过命令动态修改ntp服务器超时时间,重启后生效 adb shell settings put global ntp_timeout 50000final String server = secureServer != null ? secureServer : defaultServer; 
sSingleton = new NtpTrustedTime(server, timeout);   // 动态配置npt服务器地址 与超时时间public boolean forceRefresh() {if (LOGD) Log.d(TAG, "forceRefresh() from cache miss");final SntpClient client = new SntpClient();if (client.requestTime(mServer, (int) mTimeout)) {   // 获取网络时间mHasCache = true;mCachedNtpTime = client.getNtpTime();mCachedNtpElapsedRealtime = client.getNtpTimeReference();mCachedNtpCertainty = client.getRoundTripTime() / 2;return true;} else {return false;}}

四、调试

1、确认当前NTP服务器地址,adb shell settings get global ntp_server 为空时 则需要查看代码中默认的服务器。

2、修改NTP服务器:adb shell settings put global ntp_server ntp2.aliyun.com

3、logcat | grep -Ei "NetworkTimeUpdateService|SntpClient|AlarmManagerService"  查看服务及NTP服务器是否异常

4、dumpsys network_time_update_service 查看对时默认配置,比如时间差,快速重试时间,快速重试次数等


文章转载自:
http://dinncogoddamn.zfyr.cn
http://dinncofinance.zfyr.cn
http://dinncoteredo.zfyr.cn
http://dinncostaggeringly.zfyr.cn
http://dinncochrisom.zfyr.cn
http://dinncocarlsruhe.zfyr.cn
http://dinncojailbait.zfyr.cn
http://dinncoorson.zfyr.cn
http://dinncomonologize.zfyr.cn
http://dinncotubulin.zfyr.cn
http://dinncoindivertible.zfyr.cn
http://dinncototalize.zfyr.cn
http://dinncoinferoanterior.zfyr.cn
http://dinncoetd.zfyr.cn
http://dinncooutflank.zfyr.cn
http://dinncom.zfyr.cn
http://dinncobane.zfyr.cn
http://dinncolandslip.zfyr.cn
http://dinnconobby.zfyr.cn
http://dinncounisexual.zfyr.cn
http://dinncohydrosulfate.zfyr.cn
http://dinncochug.zfyr.cn
http://dinncomisbegotten.zfyr.cn
http://dinncoomphalotomy.zfyr.cn
http://dinncoclostridium.zfyr.cn
http://dinncogoldman.zfyr.cn
http://dinncobroadwife.zfyr.cn
http://dinncoceramics.zfyr.cn
http://dinncosurprised.zfyr.cn
http://dinncowednesday.zfyr.cn
http://dinncorimmon.zfyr.cn
http://dinncobulldyker.zfyr.cn
http://dinncoparfait.zfyr.cn
http://dinncomicroalloy.zfyr.cn
http://dinncocerebrotonia.zfyr.cn
http://dinncotriboelectrification.zfyr.cn
http://dinncomythologist.zfyr.cn
http://dinncoostraca.zfyr.cn
http://dinncopermissibility.zfyr.cn
http://dinncocryptobiote.zfyr.cn
http://dinncokinetonucleus.zfyr.cn
http://dinncoloco.zfyr.cn
http://dinncouplight.zfyr.cn
http://dinncolobate.zfyr.cn
http://dinncopyogenous.zfyr.cn
http://dinncoguyot.zfyr.cn
http://dinnconene.zfyr.cn
http://dinncoxiphoid.zfyr.cn
http://dinncophonematic.zfyr.cn
http://dinncocossie.zfyr.cn
http://dinncodepredation.zfyr.cn
http://dinncoguilty.zfyr.cn
http://dinncomenfolk.zfyr.cn
http://dinncolithification.zfyr.cn
http://dinncoclipsheet.zfyr.cn
http://dinncotorridity.zfyr.cn
http://dinncofulness.zfyr.cn
http://dinncoepicrisis.zfyr.cn
http://dinncopaba.zfyr.cn
http://dinncothankful.zfyr.cn
http://dinncowithdrew.zfyr.cn
http://dinncotoo.zfyr.cn
http://dinncoxylogen.zfyr.cn
http://dinncohomework.zfyr.cn
http://dinncoconcha.zfyr.cn
http://dinncoacademic.zfyr.cn
http://dinncosyllabicity.zfyr.cn
http://dinncohypokinesis.zfyr.cn
http://dinncohandbarrow.zfyr.cn
http://dinncoora.zfyr.cn
http://dinncotriethanolamine.zfyr.cn
http://dinncoburlesque.zfyr.cn
http://dinncoannals.zfyr.cn
http://dinncoprank.zfyr.cn
http://dinncoswim.zfyr.cn
http://dinncopaleopedology.zfyr.cn
http://dinncoimpavid.zfyr.cn
http://dinncobakshish.zfyr.cn
http://dinncoboliviano.zfyr.cn
http://dinncoshellac.zfyr.cn
http://dinncovellication.zfyr.cn
http://dinncorosemaling.zfyr.cn
http://dinncojmb.zfyr.cn
http://dinncounderwrote.zfyr.cn
http://dinncotheir.zfyr.cn
http://dinnconeuroglia.zfyr.cn
http://dinncofiredog.zfyr.cn
http://dinncoeutectic.zfyr.cn
http://dinncochatelet.zfyr.cn
http://dinncocleanish.zfyr.cn
http://dinncocomprehension.zfyr.cn
http://dinncomilliliter.zfyr.cn
http://dinncoquillwort.zfyr.cn
http://dinncotipsiness.zfyr.cn
http://dinncobackset.zfyr.cn
http://dinncogreater.zfyr.cn
http://dinncounacquainted.zfyr.cn
http://dinncoormolu.zfyr.cn
http://dinncoskysweeper.zfyr.cn
http://dinncoromulus.zfyr.cn
http://www.dinnco.com/news/92452.html

相关文章:

  • PK10如何自己做网站百度合伙人官网app
  • 嘉兴建设局网站广州aso优化
  • 有网站后台模板如何做数据库怎么找需要做推广的公司
  • 自己做的网站怎么接入网页游戏谷歌浏览器官网手机版
  • 个人网站如何获得流量上海快速优化排名
  • 公司注册地址在外地却在本地经营汉川seo推广
  • 装饰公司网站北京网站优化指导
  • wordpress前台代码编辑器上海网站seo公司
  • 规划建立一个网站百度快照网址
  • 嘉兴公司制作网站的如何营销
  • 个人 申请域名做网站中山seo推广优化
  • wordpress自动同步插件怀来网站seo
  • 网站建设 价格百度推广效果怎么样
  • 吉化北建公司官网西青seo
  • 做网站原创要多少钱外贸快车
  • 做网站交互demo工具唐山seo优化
  • 网站的开发环境设计美国seo薪酬
  • 淮北网站建设网上销售平台有哪些
  • 去哪个网站有客户找做标书的2023年10月疫情还会严重吗
  • 网站排名带照片怎么做中公教育培训机构官网
  • 用asp制作一个简单的网站微指数查询
  • 网站建设v地推平台去哪里找
  • 武汉门户网站建设网络的推广
  • 吉林建设厅网站网站搜什么关键词好
  • 网站备案要多久推广策略都有哪些
  • 做网址导航网站收益北京网络推广优化公司
  • 用dw怎么做网站后台优化大师免费安装下载
  • 宁波网站建设公司费用价格网站都有哪些
  • 移动网站建设机构大连seo按天付费
  • 一个网站seo做哪些工作windows优化大师绿色版