Skip to content

Instantly share code, notes, and snippets.

@toshiwo
Created August 3, 2013 16:08
Show Gist options
  • Save toshiwo/6146982 to your computer and use it in GitHub Desktop.
Save toshiwo/6146982 to your computer and use it in GitHub Desktop.
RubyMotionで Time.at を使おうとした際の挙動について。 Ruby2.0での挙動も乗せておきました。(1.9.3-p448でも同様でした)
irb(main):001:0> '9241205101'.to_i
=> 9241205101
irb(main):002:0> '9241205101'.to_i.class
=> Fixnum
irb(main):003:0> Time.at('9241205101'.to_i)
=> 2262-11-04 18:25:01 +0900
(main)> '9241205101'.to_i
=> 9241205101
(main)> '9241205101'.to_i.class
=> Bignum
(main)> Time.at('9241205101'.to_i)
2013-08-04 01:01:00.713 hello[32862:c07] bignum too big to convert into `long' (RangeError)
=> #<RangeError: bignum too big to convert into `long'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment