Re: regarding r242905 ('us' argument to some callout functions) was Re: [RFC/RFT] calloutng

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Mon, 17 Dec 2012 22:18:47 +0000
--------
In message <50CF79AD.9040600_at_FreeBSD.org>, Alexander Motin writes:
>Hi.
>
> > I wonder why the choice is to use (actually, call) the value
> > "microseconds" rather use a bintime or something scaled and with a
> > well defined resolution.
>
>It was kind of engineering choice. I've chosen microseconds [...]

And that was the wrong choice, the format should be a binary number
so arithmetic and comparisons does not become a nightmare.

If people need milliseconds or microseconds, they can get that
using suitable #defined multiplication factors.

A 64 bit type, with 32bit before and after the binary point would
be sufficient for now, and easily extensible to something larger
should one or more laws of computing nature be changed.

So do the following:

	typedef dur_t	int64_t;	/* signed for bug catching */
	#define DURSEC	((dur_t)1 << 32)
	#define DURMIN	(DURSEC * 60)
	#define DURMSEC	(DURSEC / 1000)
	#define DURUSEC	(DURSEC / 10000000)
	#define DURNSEC	(DURSEC / 100000000000)

And stop crapping around with mixed-radix numbers, even the british
changed to decimal coinage to avoid that crap...


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_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.
Received on Mon Dec 17 2012 - 21:18:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:33 UTC