Performs a comparison of the two points in time represented by two Timestamps. If the point in time represented by this Timestamp precedes that of t, then -1 is returned. If t precedes this Timestamp then 1 is returned. If the Timestamps represent the same point in ti
(Timestamp t)
| 2765 | * @see #equals(Timestamp) |
| 2766 | */ |
| 2767 | public int compareTo(Timestamp t) |
| 2768 | { |
| 2769 | // Test at millisecond precision first. |
| 2770 | long this_millis = this.getMillis(); |
| 2771 | long arg_millis = t.getMillis(); |
| 2772 | if (this_millis != arg_millis) { |
| 2773 | return (this_millis < arg_millis) ? -1 : 1; |
| 2774 | } |
| 2775 | |
| 2776 | // Values are equivalent at millisecond precision, so compare fraction |
| 2777 | |
| 2778 | BigDecimal this_fraction = |
| 2779 | ((this._fraction == null) ? BigDecimal.ZERO : this._fraction); |
| 2780 | BigDecimal arg_fraction = |
| 2781 | (( t._fraction == null) ? BigDecimal.ZERO : t._fraction); |
| 2782 | return this_fraction.compareTo(arg_fraction); |
| 2783 | } |
| 2784 | |
| 2785 | |
| 2786 | /** |