Issue #3538 has been updated by Aaron Patterson.


Seems this isn't just a problem with psych.  When psych fails to round trip the time, marshal seems to fail too.  Apply this patch:

diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 45cd39d..f5c6b1c 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -1154,6 +1154,14 @@ EOY
         t = Time.now
         t = Time.at(t.tv_sec, t.tv_usec)
         5.times do
+            f = Psych.load Psych.dump t
+            if f != t
+                p Psych.dump(t) => Psych.dump(f)
+                p t.to_f - f.to_f
+                p(:marshal => (t == Marshal.load(Marshal.dump(f))))
+                raise "wtf"
+            end
+            assert_equal(t, f)
             assert_cycle(t)
         end
     end

Then run the tests like this:

$ make test-all TESTS='psych/test_yaml.rb -n test_time_now_cycle'

I'm still investigating, but this is strange.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3538

----------------------------------------
http://redmine.ruby-lang.org