Java Timestamp Memo
timestamp的構造函數(shù),把微妙作為納秒存儲,
所以 Java.util.date.comepareTo(Timestamp) 結果肯定是1
另外,?Timestamp.equal(object) 如果參數(shù)不是Timestamp,肯定返回false。
Timestamp's nanos value is NOT the number of nanoseconds - it's ananosecond-resolution number of millis (i.e. fractional seconds).As such, in the Timestamp constructor, it is setting the time onthe super to be without milliseconds. Therefore, the Timestamp willalways have a lower value for the member fastTime (used in Date'scompareTo()) than the corresponding Date (unless, of course, it hasno fractional seconds).
?
???????super((time/1000)*1000);
???????nanos = (int)((time00) * 1000000);
???????if (nanos < 0) {
???????????nanos = 1000000000 + nanos;
???????????super.setTime(((time/1000)-1)*1000);
???????}
????}
轉載于:https://www.cnblogs.com/sdfczyx/p/6396702.html
總結
以上是生活随笔為你收集整理的Java Timestamp Memo的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 8、linux上安装hbase
- 下一篇: 【Java NIO深入研究3】文件锁