From owner-freebsd-arch Fri Oct 26 14:23:10 2001 Delivered-To: freebsd-arch@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by hub.freebsd.org (Postfix) with ESMTP id 8395137B406; Fri, 26 Oct 2001 14:23:06 -0700 (PDT) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.11.6/8.11.6) with ESMTP id f9QLMWM08308; Fri, 26 Oct 2001 23:22:32 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: Matthew Dillon Cc: John Baldwin , arch@FreeBSD.ORG, Peter Wemm , Bakul Shah Subject: Re: 64 bit times revisited.. In-Reply-To: Your message of "Fri, 26 Oct 2001 14:13:11 PDT." <200110262113.f9QLDBJ38657@apollo.backplane.com> Date: Fri, 26 Oct 2001 23:22:32 +0200 Message-ID: <8306.1004131352@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <200110262113.f9QLDBJ38657@apollo.backplane.com>, Matthew Dillon wri tes: > >: >: >::> >::> If you look in sys/kern/kern_tc.c you can see how much extra >::> gunk that results in, checking for overruns on the middle part and >::> whats not. >::> >::> There can be no doubt that the best timestamp representation is >::> pure binary, originating at the second, and that is how my proposal >::> is constructed: >::> >::> <-- 32bit --><-- 32bit --> . <-- 32bit --><-- 32bit --> >::> 1 2 3 4 >:: >::IOW, a fixed-point number. This is definitely the optimal solution presented >::so far for the in-kernel time keeping, IMO. > > And I will also note that trying to represent both seconds and sub-seconds > in a single fixed point integer is a real bad idea. It makes life > unnecessarily difficult for the 95% of the code that only needs the > seconds portion. Any fractional representation should be a SEPARATE > field. Matt, From binary math 101: u_int128_t x; time_t sec; x = gettime(); /* units = 1/2^64 */ sec = x >> 64; It cannot possibly be simpler... You _really_ need to loose that anti-phk reflex of yours. > We will have time_t, in seconds, and we can have struct ntm representing > both the seconds and fractional portions (as separate fields). ARGH! that is exactly the timespec braindamage I'm trying to avoid! grep sys/kern for 100000{000} if you want to see what the problem is :-( -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message