cvs commit: src/lib/libarchive archive_read_support_format_iso9660.c

Tim Kientzle kientzle at
Tue Feb 19 00:41:33 PST 2008

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.



More information about the cvs-src mailing list