diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-13 15:26:59 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-05-13 15:26:59 -0700 |
commit | 8e21278d700b988fbe9c9699fb30ae9063ec9d31 (patch) | |
tree | abc14920f2aec801c7fc61968822744daede71de /lib | |
parent | 03e245adc7d73c3538471933bafba57972b9efcb (diff) | |
download | psych-8e21278d700b988fbe9c9699fb30ae9063ec9d31.zip |
synching with ruby trunk
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/scalar_scanner.rb | 4 | ||||
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb index f7aaea7..29d66ee 100644 --- a/lib/psych/scalar_scanner.rb +++ b/lib/psych/scalar_scanner.rb @@ -80,10 +80,10 @@ module Psych def parse_time string date, time = *(string.split(/[ tT]/, 2)) (yy, m, dd) = date.split('-').map { |x| x.to_i } - md = time.match(/(\d+:\d+:\d+)(\.\d*)?\s*(Z|[-+]\d+(:\d\d)?)?/) + md = time.match(/(\d+:\d+:\d+)(?:\.(\d*))?\s*(Z|[-+]\d+(:\d\d)?)?/) (hh, mm, ss) = md[1].split(':').map { |x| x.to_i } - us = (md[2] ? Rational(md[2].sub(/^\./, '0.')) : 0) * 1000000 + us = (md[2] ? Rational("0.#{md[2]}") : 0) * 1000000 time = Time.utc(yy, m, dd, hh, mm, ss, us) diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index 84ebc90..6f90377 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -297,7 +297,7 @@ module Psych private def format_time time if time.utc? - time.strftime("%Y-%m-%d %H:%M:%S.%9NZ") + time.strftime("%Y-%m-%d %H:%M:%S.%9N Z") else time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z") end |