diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-11-17 22:57:48 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-11-17 22:57:48 -0800 |
commit | d4b969697f7877cf51023786ff648cfaae301203 (patch) | |
tree | 41caec78a0e6c76ce8ba55936768f141d8bf4408 /lib | |
parent | f024c26770bd7e79902cae79396b3b65fc1f7597 (diff) | |
download | psych-d4b969697f7877cf51023786ff648cfaae301203.zip |
more tests passing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/visitors/to_ruby.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb index c9d5bad..3b2d7f7 100644 --- a/lib/psych/visitors/to_ruby.rb +++ b/lib/psych/visitors/to_ruby.rb @@ -191,12 +191,13 @@ module Psych 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 - time = Time.utc(yy, m, dd, hh, mm, ss) + time = Time.utc(yy, m, dd, hh, mm, ss, us) - us = md[2] ? md[2].sub(/^\./, '').to_i : 0 + return time if 'Z' == md[3] - tz = (!md[3] || md[3] == 'Z') ? 0 : Integer(md[3].split(':').first) + tz = md[3] ? Integer(md[3].split(':').first) : 0 Time.at((time - (tz * 3600)).to_i, us) else token.last |