我想在我的Windows机器上安排每小时运行的作业,并使用rufus-scheduler。但是,由于下面解释的时区错误,我无法继续。
require 'rufus-scheduler'
require 'rufus-scheduler'
require 'tzinfo/data'
ENV['TZ'] = 'Asia/Chennai'
scheduler = Rufus::Scheduler::singleton
scheduler.every '1h' do
# job here
end
我经常被这个错误抛出。
C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler- 3.3.4/lib/rufus/scheduler/zotime.rb:41:in `initialize': cannot determine timezone from nil (etz:"Asia/India",tnz:"Asi",tzid:"constant") (ArgumentError)
Try setting `ENV['TZ'] = 'Continent/City'` in your script (see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler- 3.3.4/lib/rufus/scheduler/zotime.rb:206:in `new'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler- 3.3.4/lib/rufus/scheduler/zotime.rb:206:in `now'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.4/lib/rufus/scheduler.rb:561:in `start'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.4/lib/rufus/scheduler.rb:109:in `initialize'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.4/lib/rufus/scheduler.rb:116:in `new'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/rufus-scheduler-3.3.4/lib/rufus/scheduler.rb:116:in `singleton'
from scheduler.rb:9:in `<main>'
有人可以为此提供帮助吗?