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(). (I suppose I should research the Perl library > approach for computing an inverse function to gmtime(); that might > actually be simpler than this growing list of hacks.)
mktime() and timegm() basically use successive approximation (binary search) with localtime() and gmtime() - so you can fairly easily create your own timegm(). If you have a normalised date, I have a direct formula to go from year/month/day to number of days past some epoch for dates covering at least the 32-bit Unix epoch (I haven't checked to see where the boundaries actually are). -- Peter Jeremy Please excuse any delays as the result of my ISP's inability to implement an MTA that is either RFC2821-compliant or matches their claimed behaviour.
pgpBRR8DufukU.pgp
Description: PGP signature
