Commit 848f2ce8 by Tom Tromey Committed by Tom Tromey

Timestamp.java (compareTo(Object)): New method.

	* java/sql/Timestamp.java (compareTo(Object)): New method.
	(compareTo(Timestamp)): Likewise.
	(serialVersionUID): Updated.

From-SVN: r62648
parent aa634f11
2003-02-10 Tom Tromey <tromey@redhat.com>
* java/sql/Timestamp.java (compareTo(Object)): New method.
(compareTo(Timestamp)): Likewise.
(serialVersionUID): Updated.
2003-02-07 Mark Wielaard <mark@klomp.org> 2003-02-07 Mark Wielaard <mark@klomp.org>
* java/util/jar/JarFile.java (JarFile(String, boolean)): Read manifest * java/util/jar/JarFile.java (JarFile(String, boolean)): Read manifest
......
/* Time.java -- Wrapper around java.util.Date /* Time.java -- Wrapper around java.util.Date
Copyright (C) 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -52,7 +52,7 @@ import java.text.SimpleDateFormat; ...@@ -52,7 +52,7 @@ import java.text.SimpleDateFormat;
*/ */
public class Timestamp extends java.util.Date public class Timestamp extends java.util.Date
{ {
static final long serialVersionUID = 3581463369166924961L; static final long serialVersionUID = 2745179027874758501L;
/** /**
* Used for parsing and formatting this date. * Used for parsing and formatting this date.
...@@ -237,19 +237,37 @@ public class Timestamp extends java.util.Date ...@@ -237,19 +237,37 @@ public class Timestamp extends java.util.Date
} }
/** /**
* Compare two Timestamp
* @param when the other Timestamp.
* @return 0, if the date represented
* by obj is exactly the same as the time represented by this
* object, a negative if this Timestamp is before the other Timestamp, and
* a positive value otherwise.
* @since 1.2 * @since 1.2
*/ */
/*
public int compareTo(Timestamp ts) public int compareTo(Timestamp ts)
{ {
int s = super.compareTo((java.util.Date) ts);
}*/ if (s != 0)
return s;
// If Date components were equal, then we check the nanoseconds.
return nanos - ts.nanos;
}
/** /**
* Compares this Timestamp to another. This behaves like
* <code>compareTo(Timestamp)</code>, but it may throw a
* <code>ClassCastException</code>
* @param obj the other Timestamp.
* @return 0, if the Timestamp represented
* by obj is exactly the same as the time represented by this
* object, a negative if this Timestamp is before the other Timestamp, and
* a positive value otherwise.
* @exception ClassCastException if obj is not of type Timestamp.
* @since 1.2 * @since 1.2
*//* */
public int compareTo(Object obj) public int compareTo(Object obj)
{ {
return compareTo((Timestamp) obj); return compareTo((Timestamp) obj);
}*/ }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment