From owner-freebsd-current@FreeBSD.ORG Sat Oct 29 08:47:23 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F07316A41F; Sat, 29 Oct 2005 08:47:23 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au [211.29.132.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id E29E943D46; Sat, 29 Oct 2005 08:47:22 +0000 (GMT) (envelope-from PeterJeremy@optushome.com.au) Received: from cirb503493.alcatel.com.au (c220-239-19-236.belrs4.nsw.optusnet.com.au [220.239.19.236]) by mail11.syd.optusnet.com.au (8.12.11/8.12.11) with ESMTP id j9T8lH3M011310 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sat, 29 Oct 2005 18:47:20 +1000 Received: from cirb503493.alcatel.com.au (localhost.alcatel.com.au [127.0.0.1]) by cirb503493.alcatel.com.au (8.12.10/8.12.10) with ESMTP id j9T8lHHh054417; Sat, 29 Oct 2005 18:47:17 +1000 (EST) (envelope-from pjeremy@cirb503493.alcatel.com.au) Received: (from pjeremy@localhost) by cirb503493.alcatel.com.au (8.12.10/8.12.9/Submit) id j9T8lH35054416; Sat, 29 Oct 2005 18:47:17 +1000 (EST) (envelope-from pjeremy) Date: Sat, 29 Oct 2005 18:47:16 +1000 From: Peter Jeremy To: Poul-Henning Kamp Message-ID: <20051029084716.GY39882@cirb503493.alcatel.com.au> References: <20051029005719.I20147@fledge.watson.org> <37685.1130571501@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37685.1130571501@critter.freebsd.dk> User-Agent: Mutt/1.4.2.1i X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc Cc: Robert Watson , current@freebsd.org Subject: Re: Timers and timing, was: MySQL Performance 6.0rc1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 29 Oct 2005 08:47:23 -0000 On Sat, 2005-Oct-29 09:38:21 +0200, Poul-Henning Kamp wrote: >In message <20051029005719.I20147@fledge.watson.org>, Robert Watson writes: >>It strikes me that replacing time(3) with something that retrieves >>CLOCK_SECOND shouldn't harm time(3) semantics. > >It will mean that time(3) is can do minor (~1/hz) timetravel relative >to the other calls: > > clock_gettime() time(3) > > 123.999999123 > 123 > 124.000000234 > 123 ... > >If we can live with this, there is no problem. Most applications will do all their timekeeping using a single set of clock calls so I don't think this is especially serious. Does POSIX require any guarantees about (eg) clock_gettime(CLOCK_REALTIME), time() and gettimeofday() returning identical values? Can we claim "rounding and truncation" to explain the discrepancies? >>It's >>gettimeofday() that's the troubling one -- it's widely used to query the >>time in applications, and its API suggests microsecond resolution. > >And we don't really have a cheap way to do that... If we did drop the microsecond resolution, we wouldn't be alone - it used to be fairly common for tv_usec to increment in 1/hz steps. Even our manpage states that it might be incremented in ticks rather than continuously. -- Peter Jeremy