From owner-cvs-src@FreeBSD.ORG Fri Jan 19 17:45:53 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.ORG Delivered-To: cvs-src@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AEAA016A404; Fri, 19 Jan 2007 17:45:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 572AC13C4A7; Fri, 19 Jan 2007 17:45:53 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id l0JHjLH2015792; Fri, 19 Jan 2007 10:45:21 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Fri, 19 Jan 2007 10:45:42 -0700 (MST) Message-Id: <20070119.104542.-1631527280.imp@bsdimp.com> To: peterjeremy@optushome.com.au From: "M. Warner Losh" In-Reply-To: <20070119093229.GB860@turion.vk2pj.dyndns.org> References: <200701190116.l0J1GZcD021864@repoman.freebsd.org> <20070119093229.GB860@turion.vk2pj.dyndns.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Fri, 19 Jan 2007 10:45:21 -0700 (MST) Cc: cvs-src@FreeBSD.ORG, src-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/stdtime localtime.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2007 17:45:53 -0000 In message: <20070119093229.GB860@turion.vk2pj.dyndns.org> Peter Jeremy writes: : On Fri, 2007-Jan-19 01:16:35 +0000, Warner Losh wrote: : >imp 2007-01-19 01:16:35 UTC : > : > FreeBSD src repository : > : > Modified files: : > lib/libc/stdtime localtime.c : > Log: : > On FreeBSD/arm, any value > 50 bits will result in a rediculously huge : > number being returned for mktime and timegm calls. : : Actually, I have some code that can convert a UTC struct tm into a : time_t without any loops[1]. Converting localtime would need a couple : of probes to handle DST. This should be far more efficient than a : binary search. Is there any interest in this? : : [1] The date to day number core started as a FORTRAN one-liner but I : can't find the source. I've written C and perl versions and : exhaustively tested them. Part of the problem is that timegm and mktime have to work with non-normalized struct tm's. The code we have is standards conforming (or very close). If there were some kind of regression tests to prove the new code worked, then I'd love to see the current code replaced. It is somewhat twisty... Warner