From owner-freebsd-current@FreeBSD.ORG Wed Dec 19 16:18:44 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DBDCF8B5; Wed, 19 Dec 2012 16:18:43 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com [74.125.83.48]) by mx1.freebsd.org (Postfix) with ESMTP id E37578FC13; Wed, 19 Dec 2012 16:18:42 +0000 (UTC) Received: by mail-ee0-f48.google.com with SMTP id b57so1128130eek.7 for ; Wed, 19 Dec 2012 08:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=xIViPU9CBvgN8soYJD56Hq21FV9fLdRC7/cdE3yQUsk=; b=tcthfqTekjPLVMtY6Kl/0uAMJIVJBABDkvyNQKIGJ9IWFX7nQo/WnQmpSY6bURLzrc fJSl8dbiQFaB6qw9GOiNpLgRcfPbodUPXlSK8GHfA7uToaJhXGRYQQuOfvSghqq5V5oX KZyRtmd+Oi8/x+lvTaSvB+yxd0su06xLLbc5JLfCrzfBAKPABEd7hwLyS6bBDOyNy7BP t78udfSFIBKrXtWXqlkI3iEcVBuQW01re9BKCtRPq4hwDC/APS4ahDsSu82f7Z2FU29V kxQ9AdZepsHPa532RXxVYW0iiXBvIMP2AeG3AKkcbHo0Rd+VyNOeYfQ0nccjSfK3f+VP AamA== MIME-Version: 1.0 Received: by 10.14.225.72 with SMTP id y48mr15124371eep.46.1355933921454; Wed, 19 Dec 2012 08:18:41 -0800 (PST) Sender: rizzo.unipi@gmail.com Received: by 10.14.0.2 with HTTP; Wed, 19 Dec 2012 08:18:41 -0800 (PST) In-Reply-To: <17057.1355931448@critter.freebsd.dk> References: <50CF88B9.6040004@FreeBSD.org> <20121218173643.GA94266@onelab2.iet.unipi.it> <50D0B00D.8090002@FreeBSD.org> <50D0E42B.6030605@FreeBSD.org> <20121218225823.GA96962@onelab2.iet.unipi.it> <1355873265.1198.183.camel@revolution.hippie.lan> <14604.1355910848@critter.freebsd.dk> <15882.1355914308@critter.freebsd.dk> <20121219150809.GA98673@onelab2.iet.unipi.it> <17057.1355931448@critter.freebsd.dk> Date: Wed, 19 Dec 2012 08:18:41 -0800 X-Google-Sender-Auth: ePNWaUYAQ9S9zl1G8hfm2qQ3X08 Message-ID: Subject: Re: API explosion (Re: [RFC/RFT] calloutng) From: Luigi Rizzo To: Poul-Henning Kamp Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Davide Italiano , Ian Lepore , Alexander Motin , freebsd-current , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Dec 2012 16:18:44 -0000 On Wed, Dec 19, 2012 at 7:37 AM, Poul-Henning Kamp wrote: > -------- > In message <20121219150809.GA98673@onelab2.iet.unipi.it>, Luigi Rizzo > writes: > > >> 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 / 10000000000) > > >only thing, we must be careful with the parentheses > > Actually, it's more impportant to be careful with zeros, if you > adjust the above to the correct number of zeros, DURNSEC is 4, > which is within seven percent of the correct value. > counting digits is impossible for people over 45. But i have a solution for that #define DURNSEC (DURSEC / 1003006009) which is within 0.5% of the desired value. (and of course (1000*1000*1000) might do the job too) cheers luigi