赵颖科 wrote: > I`m using ntpd(ntp4.2.6p1) as client in linux(2.6.26). I have some > questions about my user app how to know the ntp client sync status. > > 1. I use ntp_gettime, is there other way?
That depends on what you want to know about the state of ntpd. You probably should want to know the error bound, in which case it is an appropriate method. If you really want to know whether it is synched, you need to use the NTP protocol to either check the stratum (note that this may take a long time to go to 16, when the last server stops responding, or more detailed state variables. > 2. If there is no server alive, when I start ntp client, why ntptime > show :ntp_gettime() returns code 0, but not code 5? I believe there was a policy decision some time ago never to declare a failure to this interface. > I trace the function loop_config in the file ntpd/ntp_loopfilter.c : > I think it should be : > ntv.maxerror = (u_int32)(MAXDISPERSE * 1e6); > ntv.esterror = (u_int32)(MAXDISPERSE * 1e6); I tend to agree. > > or not? > > 3. If ntp server no answer for 1h or shortter time, ntpd can mark > unsync stat? how could I config ntpd? > Why is this important to you? The time should still be very accurate at that point. > 本电子邮件及附件都属机密文件,并且仅供标明地址的个人或团体使用。 > 如果本电子邮件与您无关,请删除全部原始信息(包括任何原始信息的备份),并通知发件人。 1) the English version of this is not a accurate translation of the Chinese. It fails to translate 或团体使用. I know this is a common error in English versions. (The Chinese version applies to companies and other groups of people, as well as natural persons.) 2) by using this at all here, you are devaluing it, as this a publicly archived USENET newsgroup (and may also be archived as the feeder maililng list). If you use it for something that is clearly non-confidential, why should people believe you when there is some question of the confidentiality? > This email and its attachments may be confidential and are intended solely > for the use of the individual to whom it is addressed. > If you are not the intended recipient of this email and its attachments, you > must take no action based upon them, nor must you copy or show them to > anyone. Please contact the sender if you believe you have received this email > in error. > _______________________________________________ _______________________________________________ questions mailing list [email protected] http://lists.ntp.org/listinfo/questions
