Hi,
I have a problem with serialization/deserialization. I am sure I am
doing something wrong - just can't find out what it is.
First I serialize a new DateTime( 1, 1, 1, 1, 1, 1, 1, zone )
with ISODateTimeFormat.basicDateTime()
Then deserialize it again and compare the two values --> this is the result:
Expected :0001-01-01T01:01:01.001-04:56:02
Actual :0001-01-01T01:00:59.001-04:56:02
Any hints?
Thanks,
Johannes
Complete Test (TestNG based, but should run with JUnit, too)
@Test
public void testLoosingTwoSecondsTest() {
DateTimeZone oldDefault = DateTimeZone.getDefault();
try {
DateTimeZone zone = DateTimeZone.forID( "America/New_York" );
DateTimeZone.setDefault( zone );
DateTime dateTime = new DateTime( 1, 1, 1, 1, 1, 1, 1, zone );
DateTimeFormatter format = ISODateTimeFormat.basicDateTime();
//Compare string pbased
assertEquals( format.print( dateTime ), "00010101T010101.001-0456" );
//Round
assertEquals( format.parseDateTime( format.print( dateTime ) ),
dateTime );
} finally {
DateTimeZone.setDefault( oldDefault );
}
}
------------------------------------------------------------------------------
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest