Module: TimeCalc::DST

Extended by:
DST
Included in:
DST
Defined in:
lib/time_calc/dst.rb

Instance Method Summary collapse

Instance Method Details

#fix_day_diff(from, to, diff) ⇒ Object



17
18
19
20
# File 'lib/time_calc/dst.rb', line 17

def fix_day_diff(from, to, diff)
  # Just add one day when it is (DST - non-DST)
  compare(from, to) == 1 ? diff + 1 : diff
end

#fix_value(val, origin) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/time_calc/dst.rb', line 8

def fix_value(val, origin)
  case (c = compare(origin.unwrap, val.unwrap))
  when nil, 0
    val
  else
    val.+(c, :hour)
  end
end