Date: Fri, 26 Oct 2001 23:22:32 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Matthew Dillon <dillon@apollo.backplane.com> Cc: John Baldwin <jhb@FreeBSD.ORG>, arch@FreeBSD.ORG, Peter Wemm <peter@wemm.org>, Bakul Shah <bakul@bitblocks.com> Subject: Re: 64 bit times revisited.. Message-ID: <8306.1004131352@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 26 Oct 2001 14:13:11 PDT." <200110262113.f9QLDBJ38657@apollo.backplane.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8306.1004131352>
