2010/4/5 Aaron Patterson <aaron / tenderlovemaking.com>:
>
> How should this problem be fixed?  If a time object when dumped as YAML
> does not use the YAML time format, that would be surprising to me.  Is
> my assumption wrong?  I'd like to leave it the way it works now.

If the fractional seconds are representable in the decimal system,
it should be representable in the YAML time format.

For example, Ruby obtains the current time using clock_gettime if available.
clock_gettime returns struct timespec which has nano-second resolution.
It needs 9 digits to preserve the information.
But psych dumps only 6 digits.
This is why Psych.load(Psych.dump(Time.now)) doesn't round trip.

FreeBSD has bintime which is 2**(-64) second resolution.
It is also representable in the decimal system.
(It may need 64 digits, though.)
Ruby generates such time in Socket::AncillaryData#timestamp.

If the fractional seconds are not representable in the decimal system,
it is difficult problem.
I'm not sure which is better between approximation or not use the YAML time
format.
-- 
Tanaka Akira