From owner-freebsd-current Fri Dec 19 00:47:35 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id AAA04008 for current-outgoing; Fri, 19 Dec 1997 00:47:35 -0800 (PST) (envelope-from owner-freebsd-current) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id AAA03998; Fri, 19 Dec 1997 00:47:27 -0800 (PST) (envelope-from bde@zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.6.9) id TAA04332; Fri, 19 Dec 1997 19:44:43 +1100 Date: Fri, 19 Dec 1997 19:44:43 +1100 From: Bruce Evans Message-Id: <199712190844.TAA04332@godzilla.zeta.org.au> To: jmb@FreeBSD.ORG, lars@fredriks-1.pr.mcs.net Subject: Re: EDOM and hz Cc: current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> Rich Stevens recommends: >> >> if (tv->tv_sec*hz + tv_usec/tick > SHRT_MAX) { >> error = EDOM; >> goto bad; >> } >> >> >> where tick = 1,000,000 / hz >> and SHRT_MAX = 32767 >> jmb >> > >Looks like a winner to me! Anyone care to commit - or I can. Just >say the word.. Don't. Sorry I missed your main point that the current code cannot work for hz > sqrt(SHRT_MAX). Correct code only cannot work for hz > SHRT_MAX (approx.) :-). Bruce