summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/visitors
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-03 00:15:51 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-03 00:15:51 +0000
commit6fe92a3cd6b4116580ff7663180407bc0c38030f (patch)
tree71416058bc05485b9a2ca9abd49932ad3c0528d2 /ext/psych/lib/psych/visitors
parentfcb613ae477e7bf1aeb8d7c6a15ddf2585d514e7 (diff)
* ext/psych/lib/psych/visitors/yaml_tree.rb (visit_Time): use
Time#nsec to accurately serialize time objects. [ruby-core:29233] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych/visitors')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 93ccc5832b..4282e0bb0a 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -138,9 +138,9 @@ module Psych
def visit_Time o
formatted = o.strftime("%Y-%m-%d %H:%M:%S")
if o.utc?
- formatted += ".%06dZ" % [o.usec]
+ formatted += ".%06dZ" % [o.nsec]
else
- formatted += ".%06d %+.2d:00" % [o.usec, o.gmt_offset / 3600]
+ formatted += ".%06d %+.2d:00" % [o.nsec, o.gmt_offset / 3600]
end
@emitter.scalar formatted, nil, nil, true, false, Nodes::Scalar::ANY