summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rss/rss.rb2
-rw-r--r--lib/time.rb16
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index a33d21c97e..fc4f9328ac 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -28,7 +28,7 @@ class Time
datetime = apply_offset(*(datetime + [off]))
datetime << usec
time = Time.utc(*datetime)
- time.localtime unless zone_utc?(zone)
+ time.localtime(off) unless zone_utc?(zone)
time
else
datetime << usec
diff --git a/lib/time.rb b/lib/time.rb
index 8ffd42dcd7..507bf28daf 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -258,7 +258,11 @@ class Time
year, mon, day, hour, min, sec =
apply_offset(year, mon, day, hour, min, sec, off)
t = self.utc(year, mon, day, hour, min, sec, usec)
- t.localtime if !zone_utc?(zone)
+ if zone_utc?(zone)
+ t.utc
+ else
+ t.localtime(off)
+ end
t
else
self.local(year, mon, day, hour, min, sec, usec)
@@ -394,14 +398,18 @@ class Time
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
t = Time.at(seconds)
+ if zone = d[:zone]
+ if zone_utc?(zone)
+ t.utc
+ elsif offset = zone_offset(zone)
+ t.localtime(offset)
+ end
+ end
else
year = d[:year]
year = yield(year) if year && block_given?
t = make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
end
- if offset = d[:offset]
- t.localtime(offset)
- end
t
end