码迷,mamicode.com
首页 > 编程语言 > 详细

Java Timestamp Memo

时间:2017-02-14 11:33:58      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:span   cto   .com   nbsp   convert   ict   app   ret   false   

timestamp的构造函数,把微妙作为纳秒存储,
所以 Java.util.date.comepareTo(Timestamp) 结果肯定是1
另外,?Timestamp.equal(object) 如果参数不是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).
 

   publicTimestamp(long time) {
       super((time/1000)*1000);
       nanos = (int)((time00) * 1000000);
       if (nanos < 0) {
           nanos = 1000000000 + nanos;
           super.setTime(((time/1000)-1)*1000);
       }
    }

Java Timestamp Memo

标签:span   cto   .com   nbsp   convert   ict   app   ret   false   

原文地址:http://www.cnblogs.com/sdfczyx/p/6396702.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!