Skip to content

Instantly share code, notes, and snippets.

@jefflembeck
Created January 27, 2012 01:13
Show Gist options
  • Save jefflembeck/1686289 to your computer and use it in GitHub Desktop.
Save jefflembeck/1686289 to your computer and use it in GitHub Desktop.
time.localtime bug
$ rvm use 1.9.2
Using /Users/jlembeck/.rvm/gems/ruby-1.9.2-p290
$ irb
~> Console extensions: wirble ap rails2 rails3 pm interactive_editor
irb: utc = Time.now.to_i
===> 1327626629
irb: time = Time.at(utc)
===> 2012-01-26 17:10:29 -0800
irb: time.localtime("-05:00")
===> 2012-01-26 20:10:29 -0500
$ rvm use jruby-1.6.5.1
Using /Users/jlembeck/.rvm/gems/jruby-1.6.5.1
$ export JRUBY_OPTS=--1.9
$ jruby -v
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
$ jirb
~> Console extensions: wirble ap rails2 rails3 pm interactive_editor
irb: utc = Time.now.to_i
===> 1327626572
irb: time = Time.at(utc)
===> 2012-01-26 17:09:32 -0800
irb: time.localtime("-05:00")
ArgumentError: wrong number of arguments (1 for 0)
from (irb):3:in `evaluate'
from org/jruby/RubyKernel.java:1093:in `eval'
from org/jruby/RubyKernel.java:1420:in `loop'
from org/jruby/RubyKernel.java:1206:in `catch'
from org/jruby/RubyKernel.java:1206:in `catch'
from /Users/jlembeck/.rvm/rubies/jruby-1.6.5.1/bin/jirb:17:in `(root)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment