summaryrefslogtreecommitdiff
path: root/test/psych/visitors
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/visitors')
-rw-r--r--test/psych/visitors/test_to_ruby.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 077b8796a53..b5b8e1443d3 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -112,10 +112,10 @@ description:
def test_time
now = Time.now
- formatted = now.strftime("%Y-%m-%d %H:%M:%S") +
- ".%09d %+.2d:%2d" % [ now.nsec,
- now.gmt_offset / 3600,
- now.gmt_offset % 3600 / 60]
+ zone = now.strftime('%z')
+ zone = " #{zone[0,3]}:#{zone[3,5]}"
+
+ formatted = now.strftime("%Y-%m-%d %H:%M:%S.%9N") + zone
assert_equal now, Nodes::Scalar.new(formatted).to_ruby
end