Why does Time allow such a limited set of years:
irb> Time.mktime('2205-01-01')
ArgumentError: time out of range
This especially annoying when other classes like DBI use
the Time class, and when a 200-year-lease in a database
throws an exception when loaded by Ruby.
irb(main):028:0> dbh.select_all(“select begin_date,end_date from
leases”)
ArgumentError: time out of range
from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:60:in gm' from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:60:in
as_timestamp’
from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:777:in
as_timestamp' from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:80:in
coerce’
from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:395:in convert' from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:755:in
fill_array’
from (irb):28:in each_with_index' from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:754:in
fill_array’
from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:707:in fetchrow' from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:644:in
fetch’
from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:1155:in fetch_all' from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:1154:in
fetch_all’
from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:919:in fetch_all' from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:675:in
select_all’
from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:645:in execute' from /usr/lib/ruby/site_ruby/1.8/dbi/dbi.rb:671:in
select_all’
from (irb):28irb(main):029:0>
Surely if ruby can transparently do math between Fixnum’s and Bignum’s,
it could handle transparent math outside the range of the Time class,
can’t it?