开发者

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

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,tradeTimes开发者_开发技巧tamp);
    pWriter.writeDate(10,entryTimestamp);

}


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜