提交 bc2adea5 编写于 作者: L lancea

7000693: java.sql.Timestamp compareTo() issues using low values

Reviewed-by: okutsu
上级 179dde1b
...@@ -473,7 +473,9 @@ public class Timestamp extends java.util.Date { ...@@ -473,7 +473,9 @@ public class Timestamp extends java.util.Date {
* @since 1.4 * @since 1.4
*/ */
public int compareTo(Timestamp ts) { public int compareTo(Timestamp ts) {
int i = super.compareTo(ts); long thisTime = this.getTime();
long anotherTime = ts.getTime();
int i = (thisTime<anotherTime ? -1 :(thisTime==anotherTime?0 :1));
if (i == 0) { if (i == 0) {
if (nanos > ts.nanos) { if (nanos > ts.nanos) {
return 1; return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册