Permalink
Browse files

A more appropriate DST-hang fix - I hate Benjamin Franklin

Closes #109
  • Loading branch information...
1 parent 5428034 commit 9142dbede24e3c05065b288be3f4bad63b38d605 @seejohnrun committed Oct 19, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/ice_cube/validated_rule.rb
@@ -36,12 +36,17 @@ def next_time(time, schedule, closing_time)
if fwd = res.min
type = vals.first.type # get the jump type
dst_adjust = !vals.first.respond_to?(:dst_adjust?) || vals.first.dst_adjust?
- dst_adjust = false if time.utc_offset == 0
wrapper = TimeUtil::TimeWrapper.new(time, dst_adjust)
wrapper.add(type, fwd)
wrapper.clear_below(type)
- # Move over DST if blocked
- wrapper.add(:sec, time.utc_offset) until wrapper.to_time > time
+ # Move over DST if blocked, no adjustments
+ if wrapper.to_time <= time
+ wrapper = TimeUtil::TimeWrapper.new(wrapper.to_time, false)
+ until wrapper.to_time > time
+ wrapper.add(:min, 10) # smallest interval
+ end
+ end
+ # And then get the correct time out
time = wrapper.to_time
end
false

0 comments on commit 9142dbe

Please sign in to comment.