From d4b969697f7877cf51023786ff648cfaae301203 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 17 Nov 2009 22:57:48 -0800 Subject: more tests passing --- lib/psych/visitors/to_ruby.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3