This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix java.util.zip.ZipEntry.setTime


Currently, setTime mangles the time by scaling, constructing dostime,
then unscaling dostime.  The scaling is unnecessary.  Testcase added
to mauve.

2004-06-05  Jerry Quinn  <jlquinn@optonline.net>

	* java/util/zip/ZipEntry.java (setTime): Remove scaling.

--- ZipEntry.java.~1.19.~	2004-05-06 23:17:57.000000000 -0400
+++ ZipEntry.java	2004-06-05 16:06:06.000000000 -0400
@@ -168,7 +168,7 @@
     Calendar cal = getCalendar();
     synchronized (cal)
       {
-	cal.setTime(new Date(time*1000L));
+	cal.setTime(new Date(time));
 	dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
 	  | (cal.get(Calendar.MONTH) + 1) << 21
 	  | (cal.get(Calendar.DAY_OF_MONTH)) << 16
@@ -176,7 +176,6 @@
 	  | (cal.get(Calendar.MINUTE)) << 5
 	  | (cal.get(Calendar.SECOND)) >> 1;
       }
-    dostime = (int) (dostime / 1000L);
     this.known |= KNOWN_TIME;
   }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]