README.md in rufus-scheduler-3.3.2 vs README.md in rufus-scheduler-3.3.3
- old
+ new
@@ -1456,9 +1456,23 @@
scheduler.every '2s' do
puts "#{Time.now} Hello #{ENV['TZ']}!"
end
```
+On Rails you might want to try with:
+```ruby
+ENV['TZ'] = Time.zone.name # Rails only
+scheduler = Rufus::Scheduler.new
+scheduler.every '2s' do
+ puts "#{Time.now} Hello #{ENV['TZ']}!"
+end
+```
+(Hat tip to Alexander in [gh-230](https://github.com/jmettraux/rufus-scheduler/issues/230))
+
+Rails set its timezone under `config/application.rb`.
+
+Rufus-Scheduler 3.3.3 detects the presence of Rails and uses its timezone setting (tested with Rails 4), so setting `ENV['TZ']` should not be necessary.
+
The value can be determined thanks to [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
Use a "continent/city" identifier (for example "Asia/Shanghai"). Do not use an abbreviation (not "CST") and do not use a local time zone name (not "中国标准时间").
If the error persists, try to add the `tzinfo-data` to your Gemfile, as in: