From 3b87ff32de3d97780e7b077aabebc5b56a8283ab Mon Sep 17 00:00:00 2001 From: tenderlove Date: Tue, 6 Jul 2010 16:06:20 +0000 Subject: * ext/psych/lib/psych/scalar_scanner.rb (parse_time): dealing with negative partial hour time zones. [ruby-core:31064] * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto * test/psych/visitors/test_to_ruby.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/scalar_scanner.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'ext/psych/lib/psych/scalar_scanner.rb') diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb index dc6f9944fa..e1e59d37e3 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 -- cgit v1.2.3