cvs commit: src/lib/libc/stdtime localtime.c

M. Warner Losh imp at bsdimp.com
Fri Jan 19 17:45:53 UTC 2007


In message: <20070119093229.GB860 at turion.vk2pj.dyndns.org>
            Peter Jeremy <peterjeremy at optushome.com.au> 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


More information about the cvs-src mailing list