summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/scalar_scanner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib/psych/scalar_scanner.rb')
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index dc6f9944fa5..e1e59d37e3c 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -91,7 +91,14 @@ module Psych
return Time.at(time.to_i, us) unless md[3]
tz = md[3].split(':').map { |digit| Integer(digit, 10) }
- offset = tz.first * 3600 + ((tz[1] || 0) * 60)
+ offset = tz.first * 3600
+
+ if offset < 0
+ offset -= ((tz[1] || 0) * 60)
+ else
+ offset += ((tz[1] || 0) * 60)
+ end
+
Time.at((time - offset).to_i, us)
end
end