From owner-freebsd-questions@FreeBSD.ORG Wed May 29 11:04:53 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E7B3E712; Wed, 29 May 2013 11:04:53 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2E508F32; Wed, 29 May 2013 11:04:52 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id e50so5329390eek.41 for ; Wed, 29 May 2013 04:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1/Ip5YJCcJei+epzWcI30TKYV+lICnSavghIVUiljDw=; b=g6UDtKEIEQgtlNlaQ3EH9NWlgl6Wdt3HDtB9U9wxlF2QE3FmbhNHe5GXA5AwImCGXC fQx3eIEucogWtbl036EnBzxmCy9iKjNSEY2alvazJg4v+MIGuyeKKSGI/akxZwV1I1Os 0500SBEX5NMOlP1pnzp2EWWrB6tgFVnDsQbkuS9dhteVN+5b7W5yZA3ajIODM86mRBns kvhE+F4dPovlh6cV9dZbxew27NTfH+i/SkF6ARNZAZ4gVoCpyU7yivpNOq8v+hCAZ+jN mqZqVHEUro/yztdIZqdIGbfGihVnCI6tNvaEn9IH68f2/WiQOtmfo0zMgSSrLYX7ZYAk xR+g== MIME-Version: 1.0 X-Received: by 10.15.73.133 with SMTP id h5mr2255533eey.118.1369825487716; Wed, 29 May 2013 04:04:47 -0700 (PDT) Received: by 10.15.23.76 with HTTP; Wed, 29 May 2013 04:04:47 -0700 (PDT) Received: by 10.15.23.76 with HTTP; Wed, 29 May 2013 04:04:47 -0700 (PDT) In-Reply-To: <51A59C60.3010709@FreeBSD.org> References: <20130528230140.A5B396F448@smtp.hushmail.com> <51A541B5.3010905@gmail.com> <51A59C60.3010709@FreeBSD.org> Date: Wed, 29 May 2013 12:04:47 +0100 Message-ID: Subject: Re: BSD sleep From: Chris Rees To: Matthew Seaman X-Mailman-Approved-At: Wed, 29 May 2013 11:42:04 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: Kenta Suzumoto , Joshua Isom , Michael Sierchio , FreeBSD Questions , freebsd-current@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 11:04:54 -0000 On 29 May 2013 07:13, "Matthew Seaman" wrote: > > On 29/05/2013 05:59, Michael Sierchio wrote: > > On Tue, May 28, 2013 at 4:45 PM, Joshua Isom wrote: > > > > > >> You think it's trivial until you read this: > >> > >> http://infiniteundo.com/post/**25326999628/falsehoods-** > >> programmers-believe-about-time< http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time > > >> > >> > > Some days have 86400 seconds, some have 86401. There is a provision for > > two leap seconds to be applied at once, but that hasn't ever happened. > > Still, a truly correct clock, set to UTC, might someday read > > > > 23:59:59 > > 23:59:60 > > 23:59:61 > > 00:00:00 > > > > How many seconds did that hour have? > > Right. The fact that on very rare occasions a minute may not have 60 > seconds in it plus many other corner cases in calculating the current > wall-clock time is an amusing irrelevance. > > First of all, sleep deals in local elapsed time, which is a well defined > property even if the displayed wall-clock time would be all over the > place due to DST changes or relativistic effects or whatever. > > In this case, I'd be pretty surprised if GNU sleep's algorithm was > anything more complicated than to convert the stated time into seconds > and then sleep that number of seconds. And to do that conversion, it > wwould just define one minute as 60 seconds, one hour as 60 minutes, one > day as 24 hours, one week as 7 days, perhaps one month as 30 days, one > year as 365 days[*]. Sure, it's simplistic and unsophisticated, but as > an engineering solution it's good enough for the vast majority of > purposes. OK, but is this really something the OS should handle? I'm sure sleep `expr 3600 \* 2` will suffice and is perfectly readable, including being more portable. Why should we keep putting these weird "extensions" in? At some point it just becomes fiddling, and yet another source of error when porting.... Chris