[ntp:questions] use ntpd, how to know unsync status on linux system
zhaoyingke at sf-auto.com
Mon Aug 9 09:33:58 UTC 2010
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?
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 trace the function loop_config in the file ntpd/ntp_loopfilter.c :
pll_control = 1;
memset(&ntv, 0, sizeof(ntv));
ntv.modes = MOD_BITS;
ntv.status = STA_PLL;
ntv.maxerror = MAXDISPERSE;
ntv.esterror = MAXDISPERSE;
ntv.constant = sys_poll;
I think it should be :
ntv.maxerror = (u_int32)(MAXDISPERSE * 1e6);
ntv.esterror = (u_int32)(MAXDISPERSE * 1e6);
3. If ntp server no answer for 1h or shortter time, ntpd can mark unsync stat? how could I config ntpd?
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.
More information about the questions