In article <A389041B-BC9F-409F-80B4-09971F62B7DE / gmail.com>,
  Dirkjan Bussink <d.bussink / gmail.com> writes:

> I see that localtime and mktime are different, but localtime(&t) fixes  
> the time_t argument that is given to it. This is why it works  
> perfectly if the statement only enclosed by the defined(HAVE_MKTIME)  
> is removed. So it is redundant here in the way it used, so that's why  
> removing doesn't brake anything. I ran the Ruby and the entire Rails  
> test suite against it and it all works perfectly (the Rails suite  
> broke because of this issue). I've attached the patch for reference.

Your patch breaks follows.

Before your patch:
% ./ruby -e 'p Time.local((1<<31)+1899,12,31,23,59,59).to_i' 
67768036191644399

After your patch:
% ./miniruby -e 'p Time.local((1<<31)+1899,12,31,23,59,59).to_i'
-e:1:in `local': gmtime/localtime error (ArgumentError)
        from -e:1:in `<main>'

It is on a 64bit time_t environment.

% ./ruby -v
ruby 1.9.0 (2007-12-27 revision 0) [x86_64-linux]

mktime emulation using localtime fails at near the limit of
representable region.
-- 
Tanaka Akira