Bug #3085: Time dumping/loading using Psych
http://redmine.ruby-lang.org/issues/show/3085

Author: Tomo Kazahaya
Status: Open, Priority: Normal
Assigned to: Aaron Patterson, Category: ext
ruby -v: ruby 1.9.2dev (2010-04-03 trunk 27196) [i686-linux]

Due to the precision of timestamp that Psych dumps, dumped time loaded
by Psych is not always identical to the original time.

require 'psych'

time = Time.at(Time.now.sec)
p time == (Psych.load Psych.dump time) #=> true

time = Time.now
p time == (Psych.load Psych.dump time) #=> false (in my environment)

time = Time.at(Time.now.sec, Rational(1, 3))
p time == (Psych.load Psych.dump time) #=> false

According to the YAML timestamp specification [http://yaml.org/type/timestamp.html],
the standard format cannot represent time in rational.
Thus, to fully express Ruby's Time object, we have to use a format
other than the standard YAML timestamp.


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