Wednesday, 7 August 2013

32 bit ruby 1.9.2p290 Time can't handle 2038?

32 bit ruby 1.9.2p290 Time can't handle 2038?

32-bit ruby 1.9.2p290 (which I must use), seems to be having a hard time
with adding 50 years to the current time.
now = Time.now
more_time = (24*365*24*60*60)
puts "more_time.class = #{more_time.class}"
later = now + more_time
now = Time.now
more_time = (25*365*24*60*60)
puts "more_time.class = #{more_time.class}"
later = now + more_time
Produces:
more_time.class = Fixnum
more_time.class = Fixnum
ruby_time.rb:11:in `+': time + 788400000.000000 out of Time range
(RangeError) from ruby_time.rb:11
Am I running into a year 2038 problem? I don't have this issue with 64-bit
ruby 1.9.2-p290.

No comments:

Post a Comment