From owner-freebsd-bugs Tue Aug 27 13:10:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA38837B400 for ; Tue, 27 Aug 2002 13:10:06 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 845BB43E42 for ; Tue, 27 Aug 2002 13:10:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7RKA4JU086543 for ; Tue, 27 Aug 2002 13:10:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7RKA47U086542; Tue, 27 Aug 2002 13:10:04 -0700 (PDT) Date: Tue, 27 Aug 2002 13:10:04 -0700 (PDT) Message-Id: <200208272010.g7RKA47U086542@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: John Hay Subject: Re: kern/42089: ntp_gettime returns time in wrong scale Reply-To: John Hay Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR kern/42089; it has been noted by GNATS. From: John Hay 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