Permalink
Browse files

Use Time.utc instead of Time.local

  • Loading branch information...
1 parent 338930e commit 3adc56e189588bcd144ba5f68ec2f664d95783fd Ania committed Mar 14, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 lib/timecop/time_stack_item.rb
@@ -79,22 +79,23 @@ def utc_offset_to_rational(utc_offset)
def parse_time(*args)
arg = args.shift
if arg.is_a?(Time)
- arg.getlocal
+ arg.utc
elsif Object.const_defined?(:DateTime) && arg.is_a?(DateTime)
offset_difference = Time.now.utc_offset - rational_to_utc_offset(arg.offset)
- Time.local(arg.year, arg.month, arg.day, arg.hour, arg.min, arg.sec) + offset_difference
+ Time.utc(arg.year, arg.month, arg.day, arg.hour, arg.min, arg.sec, arg.zone) + offset_difference
elsif Object.const_defined?(:Date) && arg.is_a?(Date)
- Time.local(arg.year, arg.month, arg.day, 0, 0, 0)
+ Time.utc(arg.year, arg.month, arg.day, 0, 0, 0, arg.zone)
elsif args.empty? && arg.kind_of?(Integer)
- Time.now + arg
+ Time.now.utc + arg
else # we'll just assume it's a list of y/m/d/h/m/s
year = arg || 0
month = args.shift || 1
day = args.shift || 1
hour = args.shift || 0
minute = args.shift || 0
second = args.shift || 0
- Time.local(year, month, day, hour, minute, second)
+ zone = args.shift || 0
+ Time.utc(year, month, day, hour, minute, second, zone)
end
end

0 comments on commit 3adc56e

Please sign in to comment.