From owner-cvs-all@FreeBSD.ORG Tue Feb 19 08:41:33 2008 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BAC216A417; Tue, 19 Feb 2008 08:41:33 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 615D313C459; Tue, 19 Feb 2008 08:41:32 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.0.0.204] (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id m1J8fVUP014614; Tue, 19 Feb 2008 00:41:32 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <47BA963B.2060704@freebsd.org> Date: Tue, 19 Feb 2008 00:41:31 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Jeremy References: <200802190602.m1J622Fe079227@repoman.freebsd.org> <20080219071953.GP64299@server.vk2pj.dyndns.org> In-Reply-To: <20080219071953.GP64299@server.vk2pj.dyndns.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/lib/libarchive archive_read_support_format_iso9660.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 08:41:33 -0000 Peter Jeremy wrote: > On Tue, Feb 19, 2008 at 06:02:02AM +0000, Tim Kientzle wrote: > >> Without that, I >> don't see a really good alternative to just giving up and converting to >> localtime with mktime(). > > mktime() and timegm() basically use successive approximation (binary > search) with localtime() and gmtime() - so you can fairly easily > create your own timegm(). I'll probably do this soon. I thought I had some useful workarounds, but each one has broken down on some system or another. > If you have a normalised date, I have a direct formula to go from > year/month/day to number of days past some epoch ... I have such code as well, but it has some assumptions that I'm wary of: * ISO C doesn't require that time_t count seconds (POSIX does, so this is probably not a real concern in practice) * None of the standards defines the epoch (if I remember correctly, old Mac OS used a different epoch, so this is not entirely academic). I've also considered trying to measure the local system epoch and then use direct calculation from there, but that's also really messy to get right. The binary search seems the most robust approach; I just haven't had time to research it yet. Cheers, Tim