Author: doogie
Date: Wed Feb 17 17:23:07 2010
New Revision: 911088

URL: http://svn.apache.org/viewvc?rev=911088&view=rev
Log:
Remove calls to toLong in compareTo.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java?rev=911088&r1=911087&r2=911088&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java 
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java Wed 
Feb 17 17:23:07 2010
@@ -189,9 +189,31 @@
         if (this == arg0) {
             return 0;
         }
-        Long thisLong = toLong(this);
-        Long thatLong = toLong(arg0);
-        return thisLong.compareTo(thatLong);
+        int r = this.years - arg0.years;
+        if (r != 0) {
+            return r;
+        }
+        r = this.months - arg0.months;
+        if (r != 0) {
+            return r;
+        }
+        r = this.days - arg0.days;
+        if (r != 0) {
+            return r;
+        }
+        r = this.hours - arg0.hours;
+        if (r != 0) {
+            return r;
+        }
+        r = this.minutes - arg0.minutes;
+        if (r != 0) {
+            return r;
+        }
+        r = this.seconds - arg0.seconds;
+        if (r != 0) {
+            return r;
+        }
+        return this.millis - arg0.millis;
     }
 
     /** Returns <code>true</code> if this duration is negative.


Reply via email to