lib/clockwork.rb in clockwork-0.5.1 vs lib/clockwork.rb in clockwork-0.5.2
- old
+ new
@@ -1,7 +1,7 @@
require 'logger'
-require 'tzinfo'
+require 'active_support/time'
module Clockwork
@@events = []
@@ -71,20 +71,19 @@
if options[:thread]
@thread = options[:thread]
end
- tz = options[:tz] || Clockwork.config[:tz]
- @timezone = TZInfo::Timezone.get(tz) if tz
+ @timezone = options[:tz] || Clockwork.config[:tz]
end
def to_s
@job
end
def convert_timezone(t)
- @timezone ? @timezone.utc_to_local(t.dup.utc) : t
+ @timezone ? t.in_time_zone(@timezone) : t
end
def time?(t)
t = convert_timezone(t)
elapsed_ready = (@last.nil? or (t - @last).to_i >= @period)
@@ -137,10 +136,10 @@
end
def configure
yield(config)
end
-
+
def config
@@configuration
end
extend self