在序列化和反序列化java.util.Date时,PortableObjectSerializer不准1秒

时间:2011-02-21 14:31:57

标签: oracle-coherence

对于下面的代码,我注意到~1秒的差异(序列化前的长时间= 1298298092890;反序列化后的长时间= 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 个答案:

答案 0 :(得分:2)

根据API,writeDate的精度有限。请改用writeDateTime