首页 > 代码库 > Java Timestamp Memo
Java Timestamp Memo
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);
}
}
super((time/1000)*1000);
nanos = (int)((time00) * 1000000);
if (nanos < 0) {
nanos = 1000000000 + nanos;
super.setTime(((time/1000)-1)*1000);
}
}
Java Timestamp Memo
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。