From: Aaron Patterson Date: 2010-10-30T23:07:52+09:00 Subject: [ruby-core:32974] Re: [Ruby 1.9-Bug#4005] YAML fails to roundtrip Time objects --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 30, 2010 at 11:31:15AM +0900, Peter Weldon wrote: > Issue #4005 has been updated by Peter Weldon. >=20 >=20 > :~$ rvm exec ruby -v -ryaml -e 't0 =3D Time.now; p t0; p YAML::load(YAML:= :dump(t0)) =3D=3D t0' > ruby 1.9.3dev (2010-10-30 trunk 29630) [i686-linux] > 2010-10-30 02:30:09 +0000 > false > ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] > Sat Oct 30 02:30:10 +0000 2010 > true > ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux] > 2010-10-30 02:30:10 +0000 > false > ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] > 2010-10-30 02:30:11 +0000 > false >=20 > ~$ printenv | grep TZ > ~$ I'm not able to reproduce this with Syck. Can you try with Psych instead? Like this: ruby -v -ryaml -e 'YAML::ENGINE.yamler =3D "psych"; t0 =3D Time.now; p t0= ; p YAML::load(YAML::dump(t0)) =3D=3D t0' I suspect your error is due to fractional second support. Observe the output of Syck compared to Psych: ### Using Syck $ ruby -v -ryaml -e 't0 =3D Time.now; p t0; p YAML::dump(t0)' "--- 2010-10-30 07:05:46.535362 -07:00\n" ### Using Psych ruby -v -ryaml -e 'YAML::ENGINE.yamler =3D "psych"; t0 =3D Time.now; p t0= ; p YAML::dump(t0)' "--- 2010-10-30 07:06:48.118999000 -07:00\n...\n" --=20 Aaron Patterson http://tenderlovemaking.com/ --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJMzCauAAoJEJUxcLy0/6/GV/IIAJXXzSpwQF6Vt5sEJhncqdkL F2U3DCjao3y2IlMf+XVAolYL7SQs1mPNPCs5FJDeThz/DfRdRDLa5pi+7AgGVZ4R 3C0GTzGDJWwza9h+aMDuroRflHMIynz2Cm6h8F16UYtSJbWQ72DsdLoLnUwGQ3YM lYXzFX7o/IBEA3fQW5E70c1jWZR1L7kkRoQGHYjBOZh3lsRhpZh1pgYaA4qTCcc2 9ViwQDlskyq2Pqsp5PK/CHUkrXshVMC3Bz2WcZVz/RaV7cU3F0XeWdqboCr75fPS Om1Pv1430rtyCdafBSNxbmAX7taliEPKpXv2DBUknqMAXS7f8qd9oAKBj+G1tTQ= =eFmp -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9--