PortableObjectSerializer is being inaccurate by 1s when serializing and deserializing java.util.Date

244 views Asked by At

For the code like below, I notice a difference of ~ 1sec (long time before serialization=1298298092890; long time after deserialization=1298298093432)

public void readExternal(PofReader pReader) throws IOException {
    //...0 to 8 omitted for brevity
    tradeTimestamp =pReader.readDate(9);
    entryTimestamp = pReader.readDate(10);
}

public void writeExternal(PofWriter pWriter) throws IOException {
        //...0 to 8 omitted for brevity
    pWriter.writeDate(9,tradeTimestamp);
    pWriter.writeDate(10,entryTimestamp);

}
1

There are 1 answers

1
Luzifer42 On BEST ANSWER

According to the API, writeDate has a limited precision. use writeDateTime instead