summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/to_ruby.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/psych/visitors/to_ruby.rb b/lib/psych/visitors/to_ruby.rb
index 2f94be8..d4d6ac5 100644
--- a/lib/psych/visitors/to_ruby.rb
+++ b/lib/psych/visitors/to_ruby.rb
@@ -64,8 +64,10 @@ module Psych
time = Time.utc(yy, m, dd, hh, mm, ss)
+ us = md[2] ? md[2].sub(/^\./, '').to_i : 0
+
tz = (!md[3] || md[3] == 'Z') ? 0 : Integer(md[3].split(':').first)
- Time.at((time - (tz * 3600)).to_i, md[2].sub(/^\./, '').to_i)
+ Time.at((time - (tz * 3600)).to_i, us)
else
token.last
end