rufus-scheduler: cannot determine timezone from nil (ArgumentError)

hello, everyone

I have a problem, i’m in china , when i use rufus-scheduler

require 'rufus-scheduler'
scheduler = Rufus::Scheduler.new
 scheduler.in '2s' do
   puts Time.now
   puts 'Hello...Word'
 end
 scheduler.join

get a error messge:

C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.0/lib/rufus/scheduler/zotime.rb:41:in `initialize': cannot determine timezone from nil (ArgumentError)
	from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.0/lib/rufus/scheduler/zotime.rb:196:in `new'
	from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.0/lib/rufus/scheduler/zotime.rb:196:in `now'
	from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.0/lib/rufus/scheduler.rb:561:in `start'
	from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.0/lib/rufus/scheduler.rb:109:in `initialize'
	from 2.rb:16:in `new'
	from 2.rb:16:in `<main>'

my Time.now.zone is “中国标准时间” , it means ‘China Standard Time’.

may someone help me to Solve it ? thank you very much. ps: my english is not good ,sorry about that.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 28 (16 by maintainers)

Commits related to this issue

Most upvoted comments

OK, thanks a lot. I will release a 3.3.1 with the fix and state in the documentation that setting ENV['TZ'] might be necessary if cannot determine timezone from nil (ArgumentError) appears.

Quick question:

require 'rufus-scheduler'

ENV['TZ'] = 'Asia/Shangai'

scheduler = Rufus::Scheduler.new
scheduler.in '2s' do
  puts Time.now
  puts 'Hello...Word'
end
#scheduler.join
sleep 3

Does it work for you?

What’s going on?

It’s 6am and I’m having a coffee and contemplating and old issue getting hijacked.

.

@sofiabravo103 good morning, could you please open a new issue? If you think this new issue is related to the old, closed, issue here, please include a link to here and indicate why you think they are related.

In the new issue, please indicate on what operating system you are running. Please also indicate if you have the tzinfo-data gem included in your bundle (does it appear in your Gemfile.lock?).

Thanks in advance.