Date: Tue, 27 Aug 2002 13:10:04 -0700 (PDT) From: John Hay <jhay@icomtek.csir.co.za> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/42089: ntp_gettime returns time in wrong scale Message-ID: <200208272010.g7RKA47U086542@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/42089; it has been noted by GNATS. From: John Hay <jhay@icomtek.csir.co.za> To: boote@internet2.edu (Jeff W. Boote) Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: kern/42089: ntp_gettime returns time in wrong scale Date: Tue, 27 Aug 2002 21:43:14 +0200 (SAT) > > The fractional component of the ntptimeval.time structure is always currently > returned in nanoseconds from the ntp_gettime system call. It should be > returned in microseconds if the STA_NANO flag is not set. (See the > ntp_adjtime() system call.) > > I have verified that this is the case in a recent exchange with David Mills. > (the ntp author) > > > http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=3D651789.CE68D7D%40internet2.edu&rnum=1&prev=/groups%3Fq%3Dfreebsd%2Bntp%2BSTA_NANO%26ie%3DISO-8859-1%26hl%3Den That is not exactly what I read in that thread. > The next "simplest" fix would be to scale the return to microseconds unless > STA_NANO is set. Basically, you would just need to re-include the code from the > original nanokernel distribution from Mills. You are missing the part where Dave said that on FreeBSD NTP_NANO should be defined. The code you are talking about looks like this: #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 */ But if NTP_NANO is defined we will end up with exactly the code that is currently in FreeBSD or do I miss something? Why don't you rather determine if the time element in struct ntptimeval is of type struct timespec or struct timeval? John -- John Hay -- John.Hay@icomtek.csir.co.za / jhay@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208272010.g7RKA47U086542>