aboutsummaryrefslogtreecommitdiffstats
path: root/lib/time.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/time.rb')
-rw-r--r--lib/time.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/time.rb b/lib/time.rb
index f080718dff..387df1f298 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -178,8 +178,12 @@ class Time
if zone_utc?(zone)
t.utc
elsif offset ||= zone_offset(zone)
+ # Prefer the local (real) timezone over the fixed offset (artificial)
+ # timezone.
t.localtime
if t.utc_offset != offset
+ # Use the fixed offset timezone only if the local timezone cannot
+ # represent the given offset.
t.localtime(offset)
end
else