This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Fun with 64 bit Ruby: Time.at
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
I ran this little snippet today using a 64 bit Ruby on Solaris:
Time.at(2**62)
It blew up with 'ArgumentError: localtime error'. Huh? Shouldn't it work out to (2**63-1)? Is this a bug in Ruby?
Actually, no. It turns out that localtime() is limited to years less than or equal to 2147485547 (INT_MAX + 1900), because the members of struct tm are all ints.
Why not just make the tm_ struct members unsigned longs? I have no idea.